1 #ifndef OBJ_STORE_H
2 #define OBJ_STORE_H
3 
4 #include <glib.h>
5 #include <sys/types.h>
6 
7 struct _SeafileSession;
8 struct SeafObjStore;
9 
10 struct SeafObjStore *
11 seaf_obj_store_new (struct _SeafileSession *seaf, const char *obj_type);
12 
13 int
14 seaf_obj_store_init (struct SeafObjStore *obj_store);
15 
16 /* Synchronous I/O interface. */
17 
18 int
19 seaf_obj_store_read_obj (struct SeafObjStore *obj_store,
20                          const char *repo_id,
21                          int version,
22                          const char *obj_id,
23                          void **data,
24                          int *len);
25 
26 int
27 seaf_obj_store_write_obj (struct SeafObjStore *obj_store,
28                           const char *repo_id,
29                           int version,
30                           const char *obj_id,
31                           void *data,
32                           int len,
33                           gboolean need_sync);
34 
35 gboolean
36 seaf_obj_store_obj_exists (struct SeafObjStore *obj_store,
37                            const char *repo_id,
38                            int version,
39                            const char *obj_id);
40 
41 void
42 seaf_obj_store_delete_obj (struct SeafObjStore *obj_store,
43                            const char *repo_id,
44                            int version,
45                            const char *obj_id);
46 
47 typedef gboolean (*SeafObjFunc) (const char *repo_id,
48                                  int version,
49                                  const char *obj_id,
50                                  void *user_data);
51 
52 int
53 seaf_obj_store_foreach_obj (struct SeafObjStore *obj_store,
54                             const char *repo_id,
55                             int version,
56                             SeafObjFunc process,
57                             void *user_data);
58 
59 int
60 seaf_obj_store_copy_obj (struct SeafObjStore *obj_store,
61                          const char *src_store_id,
62                          int src_version,
63                          const char *dst_store_id,
64                          int dst_version,
65                          const char *obj_id);
66 
67 int
68 seaf_obj_store_remove_store (struct SeafObjStore *obj_store,
69                              const char *store_id);
70 
71 #endif
72