4 * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #ifndef __STORAGE_ADAPTOR_H__
21 #define __STORAGE_ADAPTOR_H__
24 #define API __attribute__ ((visibility("default")))
35 #include "service_adaptor_errors.h"
36 #include "cloud_service.h"
37 //#include "posix_service.h"
40 * @file storage_adaptor.h
50 * \#include <storage_adaptor.h>
56 #define URI_STORAGE "storage"
57 #define URI_CLOUD "storage/cloud"
58 #define URI_POSIX "storage/posix"
61 * @brief Describes infromation about Storage Spec
63 typedef enum _storage_spec_e
65 STORAGE_SPEC_CLOUD = (1 << 0),
66 STORAGE_SPEC_POSIX = (1 << 1),
70 * @brief Describes infromation about Storage Plugin
72 typedef struct _storage_plugin_s
78 cloud_service_h cloud;
79 // posix_service_h posix;
84 typedef struct _storage_plugin_s *storage_plugin_h;
87 * @brief Describes infromation about Storage Adaptor
89 typedef struct _storage_adaptor_s
91 GList *plugins; // storage_plugin_h
96 typedef struct _storage_adaptor_s *storage_adaptor_h;
99 * @brief Describes infromation about Storage Adaptor Listener
101 typedef struct _storage_adaptor_listener_s
103 void (*create_file_cb)(const char *uri, const char *path, void *user_data);
104 } storage_adaptor_listener_s;
105 typedef struct _storage_adaptor_listener_s *storage_adaptor_listener_h;
107 storage_adaptor_h storage_adaptor_create();
108 service_adaptor_error_e storage_adaptor_destroy(storage_adaptor_h storage);
109 service_adaptor_error_e storage_adaptor_start(storage_adaptor_h storage);
110 service_adaptor_error_e storage_adaptor_stop(storage_adaptor_h storage);
111 service_adaptor_error_e storage_adaptor_register_listener(storage_adaptor_h storage, storage_adaptor_listener_h listener);
112 service_adaptor_error_e storage_adaptor_unregister_listener(storage_adaptor_h storage, storage_adaptor_listener_h listener);
113 service_adaptor_error_e storage_adaptor_create_plugin(const char *uri, const char *name, const char *package, storage_plugin_h *plugin);
114 service_adaptor_error_e storage_adaptor_destroy_plugin(storage_plugin_h plugin);
115 service_adaptor_error_e storage_adaptor_register_plugin_service(storage_plugin_h plugin, GHashTable *service);
116 service_adaptor_error_e storage_adaptor_unregister_plugin_service(storage_plugin_h plugin);
117 service_adaptor_error_e storage_adaptor_add_plugin(storage_adaptor_h storage, storage_plugin_h plugin);
118 service_adaptor_error_e storage_adaptor_remove_plugin(storage_adaptor_h storage, storage_plugin_h plugin);
119 storage_plugin_h storage_adaptor_get_plugin(storage_adaptor_h storage, const char *uri);
120 char *storage_adaptor_get_uri(storage_adaptor_h storage, const char *package);
121 service_adaptor_error_e storage_adaptor_ref_plugin(storage_adaptor_h storage, const char *uri);
122 service_adaptor_error_e storage_adaptor_unref_plugin(storage_adaptor_h storage, const char *uri);
132 #endif /* __STORAGE_ADAPTOR_H__ */