+/* An in-memory representation of an object, which can be incrementally built
+ * before it is written out to a segment. */
+class LbsObject {
+public:
+ LbsObject();
+ ~LbsObject();
+
+ // If an object is placed in a group, it will be written out to segments
+ // only containing other objects in the same group. A group name is simply
+ // a string.
+ //std::string get_group() const { return group; }
+ void set_group(const std::string &g) { group = g; }
+
+ // Data in an object must be written all at once, and cannot be generated
+ // incrementally. Data can be an arbitrary block of binary data of any
+ // size. The pointer to the data need only remain valid until write() is
+ // called. If checksum is non-NULL then it is assumed to contain a hash
+ // value for the data; this provides an optimization in case the caller has
+ // already checksummed the data. Otherwise the set_data will compute a
+ // hash of the data itself.
+ void set_data(const char *d, size_t len, const char *checksum);
+
+ // Explicitly sets the age of the data, for later garbage-collection or
+ // repacking purposes. If not set, the age defaults to the current time.
+ // The age is stored in the database as a floating point value, expressing
+ // the time in Julian days.
+ void set_age(double age) { this->age = age; }
+
+ // Write an object to a segment, thus making it permanent. This function
+ // can be called at most once.
+ void write(TarSegmentStore *store);
+
+ // An object is assigned a permanent name once it has been written to a
+ // segment. Until that time, its name cannot be determined.
+ ObjectReference get_ref() { return ref; }
+
+private:
+ std::string group;
+ double age;
+ const char *data;
+ size_t data_len;
+ std::string checksum;
+
+ bool written;
+ ObjectReference ref;
+};
+
+/* Program through which segment data is piped before being written to file. */
+extern const char *filter_program;
+
+/* Extension which should be appended to segments written out (.tar is already
+ * included; this adds to it) */
+extern const char *filter_extension;
+
+#endif // _LBS_STORE_H