Signed-off-by: Mike Ryan <mike.ryan@inktank.com>
}
};
+
+ /*
+ * efficient hash of one or more bufferlists
+ */
+
+ class hash {
+ __u32 crc;
+
+ public:
+ hash() : crc(0) { }
+
+ void update(buffer::list& bl) {
+ crc = bl.crc32c(crc);
+ }
+
+ __u32 digest() {
+ return crc;
+ }
+ };
};
typedef buffer::ptr bufferptr;
typedef buffer::list bufferlist;
+typedef buffer::hash bufferhash;
inline bool operator>(bufferlist& l, bufferlist& r) {
return out << e.what();
}
+inline bufferhash& operator<<(bufferhash& l, bufferlist &r) {
+ l.update(r);
+ return l;
+}
+
}
#endif