tizen 2.3 release
[kernel/api/system-resource.git] / src / network / include / storage.h
1 /*
2  * resourced
3  *
4  * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
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
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  *
18  */
19
20 /*
21  *  @file: storage.h
22  *
23  *  @desc Performance management daemon. Helper function
24  *              for working with entity storage.
25  *  @version 1.0
26  *
27  */
28
29
30 #ifndef _TRAFFIC_CONTROL_TRAFFIC_STAT_STORAGE_H_
31 #define _TRAFFIC_CONTROL_TRAFFIC_STAT_STORAGE_H_
32
33 #include <sqlite3.h>
34 #include <resourced.h>
35
36 #include "app-stat.h"
37 #include "iface.h"
38
39 /**
40  * @desc Initialize database.
41  *      At present it tweak "pragma synchronous = off"
42  *       and "pragma temp_store = memory"
43  * @param filename - Full path to database
44  */
45 resourced_ret_c init_database(const char *filename);
46
47 /**
48  * @desc Store result list to database.
49  * @param stats - List of resolved application information
50  * @param flush_period - Time interval for storing data
51  * @return 1 if flushed, 0 if not
52  */
53 int store_result(struct application_stat_tree *stats, int flush_period);
54
55 /**
56  * @desc Just close sqlite statements.
57  */
58 void finalize_storage_stm(void);
59
60 /**
61  * @desc Return arguments for network interface processing.
62  *      Argument contains handler function for react on interface changes.
63  *      Changes should be reflect in the database. Whats why it's here.
64  *      We doesn't provide special entity for working with database.
65  */
66 iface_callback *create_iface_storage_callback(void);
67
68 #endif /*_TRAFFIC_CONTROL_TRAFFIC_STAT_STORAGE_H_*/