Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / os / kstore / kstore_types.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4  * Ceph - scalable distributed file system
5  *
6  * Copyright (C) 2014 Red Hat
7  *
8  * This is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License version 2.1, as published by the Free Software
11  * Foundation.  See file COPYING.
12  *
13  */
14
15 #ifndef CEPH_OSD_KSTORE_TYPES_H
16 #define CEPH_OSD_KSTORE_TYPES_H
17
18 #include <ostream>
19 #include "include/types.h"
20 #include "include/interval_set.h"
21 #include "include/utime.h"
22 #include "common/hobject.h"
23
24 namespace ceph {
25   class Formatter;
26 }
27 /// collection metadata
28 struct kstore_cnode_t {
29   uint32_t bits;   ///< how many bits of coll pgid are significant
30
31   explicit kstore_cnode_t(int b=0) : bits(b) {}
32
33   void encode(bufferlist& bl) const;
34   void decode(bufferlist::iterator& p);
35   void dump(Formatter *f) const;
36   static void generate_test_instances(list<kstore_cnode_t*>& o);
37 };
38 WRITE_CLASS_ENCODER(kstore_cnode_t)
39
40 /// onode: per-object metadata
41 struct kstore_onode_t {
42   uint64_t nid;                        ///< numeric id (locally unique)
43   uint64_t size;                       ///< object size
44   map<string, bufferptr> attrs;        ///< attrs
45   uint64_t omap_head;                  ///< id for omap root node
46   uint32_t stripe_size;                ///< stripe size
47
48   uint32_t expected_object_size;
49   uint32_t expected_write_size;
50   uint32_t alloc_hint_flags;
51
52   kstore_onode_t()
53     : nid(0),
54       size(0),
55       omap_head(0),
56       stripe_size(0),
57       expected_object_size(0),
58       expected_write_size(0),
59       alloc_hint_flags(0) {}
60
61   void encode(bufferlist& bl) const;
62   void decode(bufferlist::iterator& p);
63   void dump(Formatter *f) const;
64   static void generate_test_instances(list<kstore_onode_t*>& o);
65 };
66 WRITE_CLASS_ENCODER(kstore_onode_t)
67
68 #endif