};
struct put_info {
+ int success;
BlueSkyRCStr *val;
gint offset;
};
+struct list_info {
+ int success;
+ char *last_entry;
+};
+
static S3Status s3store_get_handler(int bufferSize, const char *buffer,
void *callbackData)
{
bluesky_store_async_unref(async);
}
+static S3Status s3store_list_handler(int isTruncated,
+ const char *nextMarker,
+ int contentsCount,
+ const S3ListBucketContent *contents,
+ int commonPrefixesCount,
+ const char **commonPrefixes,
+ void *callbackData)
+{
+ struct list_info *info = (struct list_info *)callbackData;
+ if (contentsCount > 0) {
+ g_free(info->last_entry);
+ info->last_entry = g_strdup(contents[contentsCount - 1].key);
+ }
+ return S3StatusOK;
+}
+
+static char *s3store_lookup_last(gpointer s, const char *prefix)
+{
+ S3Store *store = (S3Store *)s;
+ struct list_info info = {0, NULL};
+
+ struct S3ListBucketHandler handler;
+ handler.responseHandler.propertiesCallback
+ = s3store_properties_callback;
+ handler.responseHandler.completeCallback = s3store_response_callback;
+ handler.listBucketCallback = s3store_list_handler;
+
+ char *marker = NULL;
+
+ S3_list_bucket(&store->bucket, prefix, marker, NULL, 1024, NULL, &handler, &info);
+
+ g_print("Last key: %s\n", info.last_entry);
+
+ return S3StatusOK;
+}
+
static gpointer s3store_new(const gchar *path)
{
S3Store *store = g_new(S3Store, 1);
.destroy = s3store_destroy,
.submit = s3store_submit,
.cleanup = s3store_cleanup,
+ .lookup_last = s3store_lookup_last,
};
void bluesky_store_init_s3(void)