2 * Ceph - scalable distributed file system
4 * This is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License version 2.1, as published by the Free Software
7 * Foundation. See file COPYING.
9 * Copyright 2013 Inktank
12 #ifndef CLS_REPLICA_LOG_CLIENT_H_
13 #define CLS_REPLICA_LOG_CLIENT_H_
15 #include "cls_replica_log_ops.h"
18 class ObjectWriteOperation;
23 * Prepare a progress marker object to send out.
25 * @param progress The marker object to prepare
26 * @param entity The ID of the entity setting the progress
27 * @param marker The marker key the entity has gotten to
28 * @param time The timestamp associated with the marker
29 * param entries A list of in-progress entries prior to the marker
31 void cls_replica_log_prepare_marker(cls_replica_log_progress_marker& progress,
32 const string& entity, const string& marker,
34 const list<pair<string, utime_t> > *entries);
37 * Extract a progress marker object into its components.
39 * @param progress The marker object to extract data from
40 * @param entity [out] The ID of the entity the progress is associated with
41 * @param marker [out] The marker key the entity has gotten to
42 * @param time [out] The timestamp associated with the marker
43 * @param entries [out] List of in-progress entries prior to the marker
45 void cls_replica_log_extract_marker(const cls_replica_log_progress_marker& progress,
46 string& entity, string& marker,
48 list<pair<string, utime_t> >& entries);
51 * Add a progress marker update to a write op. The op will return 0 on
52 * success, -EEXIST if the marker conflicts with an existing one, or
53 * -EINVAL if the marker is in conflict (ie, before) the daemon's existing
56 * @param op The op to add the update to
57 * @param progress The progress marker to send
59 void cls_replica_log_update_bound(librados::ObjectWriteOperation& op,
60 const cls_replica_log_progress_marker& progress);
63 * Remove an entity's progress marker from the replica log. The op will return
64 * 0 on success, -ENOENT if the entity does not exist on the replica log, or
65 * -ENOTEMPTY if the items list on the marker is not empty.
67 * @param op The op to add the delete to
68 * @param entity The entity whose progress should be removed
70 void cls_replica_log_delete_bound(librados::ObjectWriteOperation& op,
71 const string& entity);
74 * Read the bounds on a replica log.
76 * @param io_ctx The IoCtx to use for the read
77 * @param oid The oid to direct the read to
78 * @param position_marker [out] The lowest marker key that has been reached
79 * @param oldest_time [out] Timestamp corresponding to the position marker or
80 * oldest in-progress item.
81 * @param markers [out] List of progress markers for individual daemons
83 int cls_replica_log_get_bounds(librados::IoCtx& io_ctx, const string& oid,
84 string& position_marker,
86 list<cls_replica_log_progress_marker>& markers);
88 #endif /* CLS_REPLICA_LOG_CLIENT_H_ */