]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-fs: Added flag for iteration returning object IDs.
authorTimo Sirainen <tss@iki.fi>
Tue, 17 Feb 2015 18:42:59 +0000 (20:42 +0200)
committerTimo Sirainen <tss@iki.fi>
Tue, 17 Feb 2015 18:42:59 +0000 (20:42 +0200)
The flag is only allowed to be used if FS_PROPERTY_OBJECTIDS is set
(to avoid writing extra code for backends that don't support this).

src/lib-fs/fs-api.c
src/lib-fs/fs-api.h

index 96febffcf06bc2893fec9b122b47fce851d4cb7c..986e2535623ae27c598cd74d605362c325e60e56 100644 (file)
@@ -712,6 +712,9 @@ fs_iter_init(struct fs *fs, const char *path, enum fs_iter_flags flags)
 {
        struct fs_iter *iter;
 
+       i_assert((flags & FS_ITER_FLAG_OBJECTIDS) == 0 ||
+                (fs_get_properties(fs) & FS_PROPERTY_OBJECTIDS) != 0);
+
        T_BEGIN {
                iter = fs->v.iter_init(fs, path, flags);
        } T_END;
index 56ac86394436a263b6a9967c58cde0eda941f09d..caa3f3303a333183935cdbe724b34ac4aa4f36fc 100644 (file)
@@ -28,6 +28,8 @@ enum fs_properties {
        FS_PROPERTY_COPY_METADATA       = 0x400,
        /* Backend support asynchronous file operations. */
        FS_PROPERTY_ASYNC               = 0x800,
+       /* Backend supports FS_ITER_FLAG_OBJECTIDS. */
+       FS_PROPERTY_OBJECTIDS           = 0x1000
 };
 
 enum fs_open_mode {
@@ -71,7 +73,12 @@ enum fs_iter_flags {
        /* Iterate only directories, not files */
        FS_ITER_FLAG_DIRS       = 0x01,
        /* Request asynchronous iteration. */
-       FS_ITER_FLAG_ASYNC      = 0x02
+       FS_ITER_FLAG_ASYNC      = 0x02,
+       /* Instead of returning object names, return <objectid>/<object name>.
+          If this isn't supported, the <objectid> is returned empty. The
+          object IDs are always hex-encoded data. This flag can be used only
+          if FS_PROPERTY_OBJECTIDS is enabled. */
+       FS_ITER_FLAG_OBJECTIDS  = 0x04
 };
 
 struct fs_settings {