Robust Distributed System Nucleus (rDSN)  ver 1.0.0
nfs.h
1 /*
2  * The MIT License (MIT)
3  *
4  * Copyright (c) 2015 Microsoft Corporation
5  *
6  * -=- Robust Distributed System Nucleus (rDSN) -=-
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a copy
9  * of this software and associated documentation files (the "Software"), to deal
10  * in the Software without restriction, including without limitation the rights
11  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12  * copies of the Software, and to permit persons to whom the Software is
13  * furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24  * THE SOFTWARE.
25  */
26 
27 /*
28  * Description:
29  * network file system component base interface
30  *
31  * Revision history:
32  * Mar., 2015, @imzhenyu (Zhenyu Guo), first version
33  * xxxx-xx-xx, author, fix bug about xxx
34  */
35 
36 # pragma once
37 
38 # include <dsn/service_api_c.h>
39 # include <string>
40 # include <dsn/cpp/utils.h>
41 # include <dsn/tool-api/task.h>
42 
43 namespace dsn {
44 
51  {
52  ::dsn::rpc_address source;
53  std::string source_dir;
54  std::vector<std::string> files;
55  std::string dest_dir;
56  bool overwrite;
57  };
58 
60  {
61 
62  };
63 
64  DSN_API extern void marshall(::dsn::binary_writer& writer, const remote_copy_request& val);
65 
66  DSN_API extern void unmarshall(::dsn::binary_reader& reader, /*out*/ remote_copy_request& val);
67 
68  class service_node;
69  class task_worker_pool;
70  class task_queue;
71 
72  class nfs_node
73  {
74  public:
75  template <typename T> static nfs_node* create(service_node* node)
76  {
77  return new T(node);
78  }
79 
80  typedef nfs_node* (*factory)(service_node*);
81 
82  public:
83  nfs_node(service_node* node) : _node(node) {}
84 
85  virtual ~nfs_node() {}
86 
87  virtual ::dsn::error_code start(io_modifer& ctx) = 0;
88 
89  virtual error_code stop() = 0;
90 
91  virtual void call(std::shared_ptr<remote_copy_request> rci, aio_task* callback) = 0;
92 
93  service_node* node() { return _node; }
94 
95  protected:
96  service_node* _node;
97  };
98 
100 }
task queue batches the input queue for the bound task worker(s) (threads)
Definition: task_queue.h:55
Definition: task.h:399
Definition: nfs.h:50
Definition: auto_codes.h:303
Definition: task_spec.h:184
Definition: nfs.h:59
Definition: address.h:52
Definition: nfs.h:72
Definition: address.h:61