~ubuntu-branches/ubuntu/precise/ceph/precise-proposed

« back to all changes in this revision

Viewing changes to src/rgw/rgw_access.h

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2011-04-25 10:09:05 UTC
  • mfrom: (1.1.3 upstream) (0.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110425100905-exm7dfvi2v5ick02
Tags: 0.27-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#define CEPH_RGW_ACCESS_H
3
3
 
4
4
#include <time.h>
 
5
#include <errno.h>
5
6
#include <string>
6
7
#include <vector>
7
8
#include <include/types.h>
8
9
 
9
10
#include "rgw_common.h"
10
11
 
 
12
struct md_config_t;
 
13
 
11
14
/**
12
15
 * Abstract class defining the interface for storage devices used by RGW.
13
16
 */
14
17
class RGWAccess {
15
18
public:
 
19
  virtual ~RGWAccess();
16
20
  /** do all necessary setup of the storage device */
17
 
  virtual int initialize(int argc, char *argv[]) { return 0; }
 
21
  virtual int initialize(md_config_t *conf) { return 0; }
18
22
  /** prepare a listing of all buckets. */
19
23
  virtual int list_buckets_init(std::string& id, RGWAccessHandle *handle) = 0;
20
24
  /** get the next bucket in the provided listing context. */
35
39
   *     here.
36
40
   */
37
41
  virtual int list_objects(std::string& id, std::string& bucket, int max, std::string& prefix, std::string& delim,
38
 
                           std::string& marker, std::vector<RGWObjEnt>& result, map<string, bool>& common_prefixes) = 0;
 
42
                           std::string& marker, std::vector<RGWObjEnt>& result, map<string, bool>& common_prefixes,
 
43
                           bool get_content_type) = 0;
39
44
 
40
45
  /** Create a new bucket*/
41
46
  virtual int create_bucket(std::string& id, std::string& bucket, map<std::string, bufferlist>& attrs, uint64_t auid=0) = 0;
49
54
  int put_obj(std::string& id, std::string& bucket, std::string& obj, const char *data, size_t len,
50
55
              time_t *mtime, map<std::string, bufferlist>& attrs) {
51
56
    int ret = put_obj_meta(id, bucket, obj, NULL, attrs);
52
 
    if (ret >= 0)
53
 
      ret = put_obj_data(id, bucket, obj, data, 0, len, mtime);
 
57
    if (ret >= 0) {
 
58
      ret = put_obj_data(id, bucket, obj, data, -1, len, mtime);
 
59
    }
54
60
    return ret;
55
61
  }
56
62
 
133
139
  virtual void finish_get_obj(void **handle) = 0;
134
140
 
135
141
  /**
 
142
   * a simple object read without keeping state
 
143
   */
 
144
  virtual int read(std::string& bucket, std::string& oid, off_t ofs, size_t size, bufferlist& bl) = 0;
 
145
 
 
146
  /**
136
147
   * Get the attributes for an object.
137
148
   * bucket: name of the bucket holding the object.
138
149
   * obj: name of the object
153
164
  virtual int set_attr(std::string& bucket, std::string& obj,
154
165
                       const char *name, bufferlist& bl) = 0;
155
166
 
156
 
  /** 
 
167
 /**
 
168
  * stat an object
 
169
  */
 
170
  virtual int obj_stat(std::string& bucket, std::string& obj, uint64_t *psize, time_t *pmtime) = 0;
 
171
 
 
172
  virtual bool supports_tmap() { return false; }
 
173
 
 
174
  virtual int tmap_set(std::string& bucket, std::string& obj, std::string& key, bufferlist& bl) { return -ENOTSUP; }
 
175
  virtual int tmap_create(std::string& bucket, std::string& obj, std::string& key, bufferlist& bl) { return -ENOTSUP; }
 
176
  virtual int tmap_del(std::string& bucket, std::string& obj, std::string& key) { return -ENOTSUP; }
 
177
 
 
178
  virtual int update_containers_stats(map<string, RGWBucketEnt>& m) { return -ENOTSUP; }
 
179
 
 
180
  virtual int append_async(std::string& bucket, std::string& oid, size_t size, bufferlist& bl) { return -ENOTSUP; }
 
181
 
 
182
 
 
183
 /** 
157
184
   * Given the name of the storage provider, initialize it
158
185
   * with the given arguments.
159
186
   */
160
 
  static RGWAccess *init_storage_provider(const char *type, int argc, char *argv[]);
 
187
  static RGWAccess *init_storage_provider(const char *type, md_config_t *conf);
161
188
  static RGWAccess *store;
162
189
};
163
190