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

« back to all changes in this revision

Viewing changes to src/rgw/rgw_common.h

  • Committer: Package Import Robot
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2012-02-05 10:07:38 UTC
  • mfrom: (1.1.7) (0.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20120205100738-00s0bxx93mamy8tk
Tags: 0.41-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
#include "common/ceph_crypto.h"
19
19
#include "common/debug.h"
 
20
#include "common/perf_counters.h"
20
21
 
21
22
#include "acconfig.h"
22
23
#ifdef FASTCGI_INCLUDE_DIR
61
62
 
62
63
#define RGW_MAX_CHUNK_SIZE      (512*1024)
63
64
#define RGW_MAX_PENDING_CHUNKS  16
 
65
#define RGW_MAX_PUT_SIZE        (5ULL*1024*1024*1024)
64
66
 
65
67
#define RGW_FORMAT_XML          1
66
68
#define RGW_FORMAT_JSON         2
79
81
     char __buf[l]; \
80
82
     n = snprintf(__buf, sizeof(__buf), format, __VA_ARGS__); \
81
83
     if (n != l) \
82
 
       dout(0) << "--> " << __buf << dendl; \
 
84
       dout(10) << "--> " << __buf << dendl; \
83
85
       break; \
84
86
     l *= 2; \
85
87
   } \
120
122
#define ERR_NOT_MODIFIED         2016
121
123
#define ERR_INVALID_UTF8         2017
122
124
#define ERR_UNPROCESSABLE_ENTITY 2018
 
125
#define ERR_TOO_LARGE            2019
123
126
#define ERR_USER_SUSPENDED       2100
124
127
#define ERR_INTERNAL_ERROR       2200
125
128
 
126
129
typedef void *RGWAccessHandle;
127
130
 
 
131
 
 
132
/* perf counter */
 
133
 
 
134
extern PerfCounters *perfcounter;
 
135
 
 
136
extern int rgw_perf_start(CephContext *cct);
 
137
extern void rgw_perf_stop(CephContext *cct);
 
138
 
 
139
enum {
 
140
  l_rgw_first = 15000,
 
141
  l_rgw_req,
 
142
  l_rgw_failed_req,
 
143
 
 
144
  l_rgw_get,
 
145
  l_rgw_get_b,
 
146
  l_rgw_get_lat,
 
147
 
 
148
  l_rgw_put,
 
149
  l_rgw_put_b,
 
150
  l_rgw_put_lat,
 
151
 
 
152
  l_rgw_qlen,
 
153
  l_rgw_qactive,
 
154
 
 
155
  l_rgw_cache_hit,
 
156
  l_rgw_cache_miss,
 
157
 
 
158
  l_rgw_last,
 
159
};
 
160
 
 
161
 
128
162
 /* size should be the required string size + 1 */
129
163
extern int gen_rand_base64(char *dest, int size);
130
164
extern int gen_rand_alphanumeric(char *dest, int size);
233
267
  OP_DELETE,
234
268
  OP_HEAD,
235
269
  OP_POST,
 
270
  OP_COPY,
236
271
  OP_UNKNOWN,
237
272
};
238
273
 
466
501
{
467
502
  RGWObjCategory category;
468
503
  uint64_t num_kb;
 
504
  uint64_t num_kb_rounded;
469
505
  uint64_t num_objects;
470
506
};
471
507
 
533
569
 
534
570
   void *obj_ctx;
535
571
 
 
572
   string dialect;
 
573
 
536
574
   req_state(struct RGWEnv *e);
537
575
   ~req_state();
538
576
};
562
600
struct RGWBucketEnt {
563
601
  rgw_bucket bucket;
564
602
  size_t size;
 
603
  size_t size_rounded;
565
604
  time_t mtime;
566
605
  uint64_t count;
567
606
 
 
607
  RGWBucketEnt() : size(0), size_rounded(0), mtime(0), count(0) {}
 
608
 
568
609
  void encode(bufferlist& bl) const {
569
 
    __u8 struct_v = 3;
 
610
    __u8 struct_v = 4;
570
611
    ::encode(struct_v, bl);
571
612
    uint64_t s = size;
572
613
    __u32 mt = mtime;
575
616
    ::encode(mt, bl);
576
617
    ::encode(count, bl);
577
618
    ::encode(bucket, bl);
 
619
    s = size_rounded;
 
620
    ::encode(s, bl);
578
621
  }
579
622
  void decode(bufferlist::iterator& bl) {
580
623
    __u8 struct_v;
590
633
      ::decode(count, bl);
591
634
    if (struct_v >= 3)
592
635
      ::decode(bucket, bl);
 
636
    if (struct_v >= 4)
 
637
      ::decode(s, bl);
 
638
    size_rounded = s;
593
639
  }
594
640
  void clear() {
595
641
    bucket.clear();
596
642
    size = 0;
 
643
    size_rounded = 0;
597
644
    mtime = 0;
598
645
    count = 0;
599
646
  }