0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Factory.cc
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 3
9  * of the License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
26 
27 #include <Common/Compat.h>
28 
29 #include "Factory.h"
30 
31 #include "Append.h"
32 #include "Close.h"
33 #include "Create.h"
34 #include "Debug.h"
35 #include "Exists.h"
36 #include "Factory.h"
37 #include "Flush.h"
38 #include "Length.h"
39 #include "Mkdirs.h"
40 #include "Open.h"
41 #include "Pread.h"
42 #include "Readdir.h"
43 #include "Read.h"
44 #include "Remove.h"
45 #include "Rename.h"
46 #include "Rmdir.h"
47 #include "Seek.h"
48 #include "Status.h"
49 #include "Sync.h"
50 
51 #include <Common/Logger.h>
52 #include <Common/Error.h>
53 
54 using namespace Hypertable;
56 
58  EventPtr &event) {
59 
60  switch (event->header.command) {
61 
62  case FUNCTION_OPEN:
63  return new Open(comm, broker, event);
64  case FUNCTION_CREATE:
65  return new Create(comm, broker, event);
66  case FUNCTION_CLOSE:
67  return new Close(comm, broker, event);
68  case FUNCTION_READ:
69  return new Read(comm, broker, event);
70  case FUNCTION_APPEND:
71  return new Append(comm, broker, event);
72  case FUNCTION_SEEK:
73  return new Seek(comm, broker, event);
74  case FUNCTION_REMOVE:
75  return new Remove(comm, broker, event);
76  case FUNCTION_LENGTH:
77  return new Length(comm, broker, event);
78  case FUNCTION_PREAD:
79  return new Pread(comm, broker, event);
80  case FUNCTION_MKDIRS:
81  return new Mkdirs(comm, broker, event);
82  case FUNCTION_STATUS:
83  return new Status(comm, broker, event);
84  case FUNCTION_FLUSH:
85  return new Flush(comm, broker, event);
86  case FUNCTION_RMDIR:
87  return new Rmdir(comm, broker, event);
88  case FUNCTION_READDIR:
89  return new Readdir(comm, broker, event);
90  case FUNCTION_EXISTS:
91  return new Exists(comm, broker, event);
92  case FUNCTION_RENAME:
93  return new Rename(comm, broker, event);
94  case FUNCTION_DEBUG:
95  return new Debug(comm, broker, event);
96  case FUNCTION_SYNC:
97  return new Sync(comm, broker, event);
98  default:
100  "%d", (int)event->header.command);
101  }
102 
103  return nullptr;
104 }
Application handler for mkdirs function.
Definition: Mkdirs.h:46
Application handler for append function.
Definition: Append.h:46
Application handler for readdir function.
Definition: Readdir.h:46
Declarations for Create request handler.
Application handler for read function.
Definition: Read.h:46
Abstract class to be implemented by brokers.
Definition: Broker.h:51
Declarations for Status request handler.
std::shared_ptr< Event > EventPtr
Smart pointer to Event.
Definition: Event.h:228
Application handler for create function.
Definition: Create.h:46
Application handler for open function.
Definition: Open.h:46
Application handler for rename function.
Definition: Rename.h:46
Application handler for remove function.
Definition: Remove.h:46
static ApplicationHandler * create(Comm *comm, Broker *broker, EventPtr &event)
Constructs a handler class from a request event.
Definition: Factory.cc:57
Declarations for Remove request handler.
Application handler for seek function.
Definition: Seek.h:46
Application handler for status function.
Definition: Status.h:46
Declarations for Pread request handler.
Logging routines and macros.
Application handler for pread function.
Definition: Pread.h:46
Compatibility Macros for C/C++.
Declarations for Read request handler.
Declarations for Sync request handler.
Declarations for Rmdir request handler.
Application handler for exists function.
Definition: Exists.h:46
Declarations for Open request handler.
Declarations for Close request handler.
Application handler for rmdir function.
Definition: Rmdir.h:46
Declarations for Mkdirs request handler.
Application handler for debug function.
Definition: Debug.h:47
Hypertable definitions
Declarations for Seek request handler.
Application handler for close function.
Definition: Close.h:46
Entry point to AsyncComm service.
Definition: Comm.h:61
Declarations for Rename request handler.
Declarations for Exists request handler.
Declarations for Debug request handler.
Declarations for Flush request handler.
#define HT_THROWF(_code_, _fmt_,...)
Definition: Error.h:490
Base clase for application handlers.
Application handler for length function.
Definition: Length.h:46
Declarations for Length request handler.
Application handler for sync function.
Definition: Sync.h:46
Declarations for Readdir request handler.
Application handler for flush function.
Definition: Flush.h:46
Error codes, Exception handling, error logging.
Declarations for FsBroker request handler Factory.
Declarations for Append request handler.