Flex  0.17.9
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
gs::GraphDB Class Reference

#include <graph_db.h>

Collaboration diagram for gs::GraphDB:
Collaboration graph
[legend]

Public Member Functions

 GraphDB ()
 
 ~GraphDB ()
 
Result< bool > Open (const Schema &schema, const std::string &data_dir, int32_t thread_num=1, bool warmup=false, bool memory_only=true, bool enable_auto_compaction=false)
 Load the graph from data directory. More...
 
Result< bool > Open (const GraphDBConfig &config)
 
void Close ()
 Close the current opened graph. More...
 
ReadTransaction GetReadTransaction ()
 Create a transaction to read vertices and edges. More...
 
InsertTransaction GetInsertTransaction (int thread_id=0)
 Create a transaction to insert vertices and edges with a default allocator. More...
 
SingleVertexInsertTransaction GetSingleVertexInsertTransaction (int thread_id=0)
 Create a transaction to insert a single vertex. More...
 
SingleEdgeInsertTransaction GetSingleEdgeInsertTransaction (int thread_id=0)
 Create a transaction to insert a single edge. More...
 
UpdateTransaction GetUpdateTransaction (int thread_id=0)
 Create a transaction to update vertices and edges. More...
 
const MutablePropertyFragmentgraph () const
 
MutablePropertyFragmentgraph ()
 
const Schemaschema () const
 
std::shared_ptr< ColumnBaseget_vertex_property_column (uint8_t label, const std::string &col_name) const
 
AppWrapper CreateApp (uint8_t app_type, int thread_id)
 
void GetAppInfo (Encoder &result)
 
GraphDBSessionGetSession (int thread_id)
 
const GraphDBSessionGetSession (int thread_id) const
 
int SessionNum () const
 
void UpdateCompactionTimestamp (timestamp_t ts)
 
timestamp_t GetLastCompactionTimestamp () const
 

Static Public Member Functions

static GraphDBget ()
 

Private Member Functions

bool registerApp (const std::string &path, uint8_t index=0)
 
void ingestWals (const std::vector< std::string > &wals, const std::string &work_dir, int thread_num)
 
void initApps (const std::unordered_map< std::string, std::pair< std::string, uint8_t >> &plugins)
 
void openWalAndCreateContexts (const std::string &data_dir_path, MemoryStrategy allocator_strategy)
 
void showAppMetrics () const
 
size_t getExecutedQueryNum () const
 

Private Attributes

std::string work_dir_
 
SessionLocalContextcontexts_
 
int thread_num_
 
MutablePropertyFragment graph_
 
VersionManager version_manager_
 
std::array< std::string, 256 > app_paths_
 
std::array< std::shared_ptr< AppFactoryBase >, 256 > app_factories_
 
std::thread monitor_thread_
 
bool monitor_thread_running_
 
timestamp_t last_compaction_ts_
 
bool compact_thread_running_ = false
 
std::thread compact_thread_
 

Friends

class GraphDBSession
 

Constructor & Destructor Documentation

◆ GraphDB()

gs::GraphDB::GraphDB ( )
default

◆ ~GraphDB()

gs::GraphDB::~GraphDB ( )

Member Function Documentation

◆ Close()

void gs::GraphDB::Close ( )

Close the current opened graph.

◆ CreateApp()

AppWrapper gs::GraphDB::CreateApp ( uint8_t  app_type,
int  thread_id 
)

◆ get()

GraphDB & gs::GraphDB::get ( )
static

◆ get_vertex_property_column()

std::shared_ptr< ColumnBase > gs::GraphDB::get_vertex_property_column ( uint8_t  label,
const std::string &  col_name 
) const

◆ GetAppInfo()

void gs::GraphDB::GetAppInfo ( Encoder result)

◆ getExecutedQueryNum()

size_t gs::GraphDB::getExecutedQueryNum ( ) const
private

◆ GetInsertTransaction()

InsertTransaction gs::GraphDB::GetInsertTransaction ( int  thread_id = 0)

Create a transaction to insert vertices and edges with a default allocator.

Returns
InsertTransaction

◆ GetLastCompactionTimestamp()

timestamp_t gs::GraphDB::GetLastCompactionTimestamp ( ) const

◆ GetReadTransaction()

ReadTransaction gs::GraphDB::GetReadTransaction ( )

Create a transaction to read vertices and edges.

Returns
graph_dir The directory of graph data.

◆ GetSession() [1/2]

GraphDBSession & gs::GraphDB::GetSession ( int  thread_id)

◆ GetSession() [2/2]

const GraphDBSession & gs::GraphDB::GetSession ( int  thread_id) const

◆ GetSingleEdgeInsertTransaction()

SingleEdgeInsertTransaction gs::GraphDB::GetSingleEdgeInsertTransaction ( int  thread_id = 0)

Create a transaction to insert a single edge.

Parameters
allocAllocator to allocate memory for graph.
Returns

◆ GetSingleVertexInsertTransaction()

SingleVertexInsertTransaction gs::GraphDB::GetSingleVertexInsertTransaction ( int  thread_id = 0)

Create a transaction to insert a single vertex.

Parameters
allocAllocator to allocate memory for graph.
Returns
SingleVertexInsertTransaction

◆ GetUpdateTransaction()

UpdateTransaction gs::GraphDB::GetUpdateTransaction ( int  thread_id = 0)

Create a transaction to update vertices and edges.

Parameters
allocAllocator to allocate memory for graph.
Returns
UpdateTransaction

◆ graph() [1/2]

MutablePropertyFragment& gs::GraphDB::graph ( )

◆ graph() [2/2]

MutablePropertyFragment & gs::GraphDB::graph ( ) const

◆ ingestWals()

void gs::GraphDB::ingestWals ( const std::vector< std::string > &  wals,
const std::string &  work_dir,
int  thread_num 
)
private

◆ initApps()

void gs::GraphDB::initApps ( const std::unordered_map< std::string, std::pair< std::string, uint8_t >> &  plugins)
private

◆ Open() [1/2]

Result< bool > gs::GraphDB::Open ( const GraphDBConfig config)

◆ Open() [2/2]

Result< bool > gs::GraphDB::Open ( const Schema schema,
const std::string &  data_dir,
int32_t  thread_num = 1,
bool  warmup = false,
bool  memory_only = true,
bool  enable_auto_compaction = false 
)

Load the graph from data directory.

Parameters
schemaThe schema of graph. It should be the same as the schema, except that the procedure enable_lists changes.
data_dirThe directory of graph data.
thread_numThe number of threads for graph db concurrency
warmupWhether to warmup the graph db.

◆ openWalAndCreateContexts()

void gs::GraphDB::openWalAndCreateContexts ( const std::string &  data_dir_path,
MemoryStrategy  allocator_strategy 
)
private

◆ registerApp()

bool gs::GraphDB::registerApp ( const std::string &  path,
uint8_t  index = 0 
)
private

◆ schema()

const Schema & gs::GraphDB::schema ( ) const

◆ SessionNum()

int gs::GraphDB::SessionNum ( ) const

◆ showAppMetrics()

void gs::GraphDB::showAppMetrics ( ) const
private

◆ UpdateCompactionTimestamp()

void gs::GraphDB::UpdateCompactionTimestamp ( timestamp_t  ts)

Friends And Related Function Documentation

◆ GraphDBSession

friend class GraphDBSession
friend

Member Data Documentation

◆ app_factories_

std::array<std::shared_ptr<AppFactoryBase>, 256> gs::GraphDB::app_factories_
private

◆ app_paths_

std::array<std::string, 256> gs::GraphDB::app_paths_
private

◆ compact_thread_

std::thread gs::GraphDB::compact_thread_
private

◆ compact_thread_running_

bool gs::GraphDB::compact_thread_running_ = false
private

◆ contexts_

SessionLocalContext* gs::GraphDB::contexts_
private

◆ graph_

MutablePropertyFragment gs::GraphDB::graph_
private

◆ last_compaction_ts_

timestamp_t gs::GraphDB::last_compaction_ts_
private

◆ monitor_thread_

std::thread gs::GraphDB::monitor_thread_
private

◆ monitor_thread_running_

bool gs::GraphDB::monitor_thread_running_
private

◆ thread_num_

int gs::GraphDB::thread_num_
private

◆ version_manager_

VersionManager gs::GraphDB::version_manager_
private

◆ work_dir_

std::string gs::GraphDB::work_dir_
private

The documentation for this class was generated from the following files: