struct SeafObjStore * seaf_obj_store_new (SeafileSession *seaf, const char *obj_type) { SeafObjStore *store = g_new0 (SeafObjStore, 1); if (!store) return NULL; #ifdef SEAFILE_SERVER store->bend = load_obj_backend (seaf->config, obj_type); #endif if (!store->bend) { char *obj_dir; obj_dir = g_build_filename (seaf->seaf_dir, obj_type, NULL); store->bend = obj_backend_fs_new (obj_dir); g_free (obj_dir); if (!store->bend) { g_warning ("[Object store] Failed to load backend.\n"); g_free (store); return NULL; } } return store; }
struct SeafObjStore * seaf_obj_store_new (SeafileSession *seaf, const char *obj_type) { SeafObjStore *store = g_new0 (SeafObjStore, 1); if (!store) return NULL; store->bend = obj_backend_fs_new (seaf->seaf_dir, obj_type); if (!store->bend) { g_warning ("[Object store] Failed to load backend.\n"); g_free (store); return NULL; } return store; }
static ObjBackend* load_filesystem_obj_backend(GKeyFile *config, const char *bend_group) { ObjBackend *bend; char *obj_dir; obj_dir = g_key_file_get_string (config, bend_group, "object_dir", NULL); if (!obj_dir) { g_warning ("[Object store] Object dir not set in config for %s.\n", bend_group); return NULL; } bend = obj_backend_fs_new (obj_dir); g_free (obj_dir); return bend; }