diff options
| author | Joseph Fernandes <josferna@redhat.com> | 2015-02-18 19:45:23 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2015-03-18 10:36:42 -0700 | 
| commit | 87c7fa3cfdadca4ee883daf84373302a42ad5fdc (patch) | |
| tree | e61b744ea3c2058a95a5057bb8c2fe7763eb101f /libglusterfs/src/gfdb/gfdb_sqlite3_helper.h | |
| parent | dbd62a8d2b50392fbed0a0781a4f241dadb8f506 (diff) | |
Adding Libgfdb to GlusterFS
*************************************************************************
			Libgfdb						|
*************************************************************************
Libgfdb provides abstract mechanism to record extra/rich metadata
required for data maintenance, such as data tiering/classification.
It provides consumer with API for recording and querying, keeping
the consumer abstracted from the data store used beneath for storing data.
It works in a plug-and-play model, where data stores can be plugged-in.
Presently we have plugin for Sqlite3. In the future will provide recording
and querying performance optimizer. In the current implementation the schema
of metadata is fixed.
Schema:
~~~~~~
      GF_FILE_TB Table:
      ~~~~~~~~~~~~~~~~~
      This table has one entry per file inode. It holds the metadata required to
      make decisions in data maintenance.
      GF_ID (Primary key)	: File GFID (Universal Unique IDentifier in the namespace)
      W_SEC, W_MSEC 		: Write wind time in sec & micro-sec
      UW_SEC, UW_MSEC		: Write un-wind time in sec & micro-sec
      W_READ_SEC, W_READ_MSEC 	: Read wind time in sec & micro-sec
      UW_READ_SEC, UW_READ_MSEC : Read un-wind time in sec & micro-sec
      WRITE_FREQ_CNTR INTEGER	: Write Frequency Counter
      READ_FREQ_CNTR INTEGER	: Read Frequency Counter
      GF_FLINK_TABLE:
      ~~~~~~~~~~~~~~
      This table has all the hardlinks to a file inode.
      GF_ID		: File GFID               (Composite Primary Key)``|
      GF_PID		: Parent Directory GFID  (Composite Primary Key)   |-> Primary Key
      FNAME 		: File Base Name          (Composite Primary Key)__|
      FPATH 		: File Full Path (Its redundant for now, this will go)
      W_DEL_FLAG 	: This Flag is used for crash consistancy, when a link is unlinked.
                  	  i.e Set to 1 during unlink wind and during unwind this record
                          is deleted
      LINK_UPDATE 	: This Flag is used when a link is changed i.e rename.
                          Set to 1 when rename wind and set to 0 in rename unwind
Libgfdb API:
~~~~~~~~~~~
Refer libglusterfs/src/gfdb/gfdb_data_store.h
Change-Id: I2e9fbab3878ce630a7f41221ef61017dc43db11f
BUG: 1194753
Signed-off-by: Joseph Fernandes <josferna@redhat.com>
Signed-off-by: Dan Lambright <dlambrig@redhat.com>
Signed-off-by: Joseph Fernandes <josferna@redhat.com>
Reviewed-on: http://review.gluster.org/9683
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'libglusterfs/src/gfdb/gfdb_sqlite3_helper.h')
| -rw-r--r-- | libglusterfs/src/gfdb/gfdb_sqlite3_helper.h | 64 | 
1 files changed, 64 insertions, 0 deletions
diff --git a/libglusterfs/src/gfdb/gfdb_sqlite3_helper.h b/libglusterfs/src/gfdb/gfdb_sqlite3_helper.h new file mode 100644 index 00000000000..8b62be1d4d0 --- /dev/null +++ b/libglusterfs/src/gfdb/gfdb_sqlite3_helper.h @@ -0,0 +1,64 @@ +/* +   Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com> +   This file is part of GlusterFS. + +   This file is licensed to you under your choice of the GNU Lesser +   General Public License, version 3 or any later version (LGPLv3 or +   later), or the GNU General Public License, version 2 (GPLv2), in all +   cases as published by the Free Software Foundation. +*/ +#ifndef __GFDB_SQLITE3_HELPER_H +#define __GFDB_SQLITE3_HELPER_H + + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "gfdb_sqlite3.h" + +/****************************************************************************** + * + *                      Helper functions for gf_sqlite3_insert() + * + * ****************************************************************************/ + + +int +gf_sql_insert_wind (gf_sql_connection_t  *sql_conn, +                   gfdb_db_record_t     *gfdb_db_record); + +int +gf_sql_insert_unwind (gf_sql_connection_t  *sql_conn, +                     gfdb_db_record_t     *gfdb_db_record); + + +int +gf_sql_update_delete_wind (gf_sql_connection_t  *sql_conn, +                          gfdb_db_record_t     *gfdb_db_record); + +int +gf_sql_delete_unwind (gf_sql_connection_t  *sql_conn, +                          gfdb_db_record_t     *gfdb_db_record); + + + + + +/****************************************************************************** + * + *                      Find/Query helper functions + * + * ****************************************************************************/ + + +int +gf_sql_query_function (sqlite3_stmt              *prep_stmt, +                      gf_query_callback_t       query_callback, +                      void                      *_query_cbk_args); + +int +gf_sql_clear_counters (gf_sql_connection_t *sql_conn); + +#endif  | 
