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

#include <graph_db_session.h>

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

Public Types

enum  InputFormat : uint8_t { InputFormat::kCppEncoder = 0, InputFormat::kCypherJson = 1, InputFormat::kCypherProtoAdhoc = 2, InputFormat::kCypherProtoProcedure = 3 }
 

Public Member Functions

 GraphDBSession (GraphDB &db, Allocator &alloc, WalWriter &logger, const std::string &work_dir, int thread_id)
 
 ~GraphDBSession ()
 
ReadTransaction GetReadTransaction () const
 
InsertTransaction GetInsertTransaction ()
 
SingleVertexInsertTransaction GetSingleVertexInsertTransaction ()
 
SingleEdgeInsertTransaction GetSingleEdgeInsertTransaction ()
 
UpdateTransaction GetUpdateTransaction ()
 
CompactTransaction GetCompactTransaction ()
 
bool BatchUpdate (UpdateBatch &batch)
 
const MutablePropertyFragmentgraph () const
 
MutablePropertyFragmentgraph ()
 
const GraphDBdb () const
 
const Schemaschema () const
 
std::shared_ptr< ColumnBaseget_vertex_property_column (uint8_t label, const std::string &col_name) const
 
std::shared_ptr< RefColumnBaseget_vertex_id_column (uint8_t label) const
 
Result< std::vector< char > > Eval (const std::string &input)
 
void GetAppInfo (Encoder &result)
 
int SessionId () const
 
bool Compact ()
 
double eval_duration () const
 
const AppMetricGetAppMetric (int idx) const
 
int64_t query_num () const
 
AppBaseGetApp (int idx)
 

Static Public Attributes

static constexpr int32_t MAX_RETRY = 3
 
static constexpr int32_t MAX_PLUGIN_NUM = 256
 
static constexpr const char * kCppEncoderStr = "\x00"
 
static constexpr const char * kCypherJsonStr = "\x01"
 
static constexpr const char * kCypherProtoAdhocStr = "\x02"
 
static constexpr const char * kCypherProtoProcedureStr = "\x03"
 

Private Member Functions

Result< std::pair< uint8_t, std::string_view > > parse_query_type_from_cypher_json (const std::string_view &input)
 
Result< std::pair< uint8_t, std::string_view > > parse_query_type_from_cypher_internal (const std::string_view &input)
 
Result< std::pair< uint8_t, std::string_view > > parse_query_type (const std::string &input)
 Parse the input format of the query. There are four formats: 0. CppEncoder: This format will be used by interactive-sdk to submit c++ stored prcoedure queries. The second last byte is the query id. More...
 

Private Attributes

GraphDBdb_
 
Allocatoralloc_
 
WalWriterlogger_
 
std::string work_dir_
 
int thread_id_
 
std::array< AppWrapper, MAX_PLUGIN_NUMapp_wrappers_
 
std::array< AppBase *, MAX_PLUGIN_NUMapps_
 
std::array< AppMetric, MAX_PLUGIN_NUMapp_metrics_
 
std::atomic< int64_t > eval_duration_
 
std::atomic< int64_t > query_num_
 

Member Enumeration Documentation

◆ InputFormat

enum gs::GraphDBSession::InputFormat : uint8_t
strong
Enumerator
kCppEncoder 
kCypherJson 
kCypherProtoAdhoc 
kCypherProtoProcedure 

Constructor & Destructor Documentation

◆ GraphDBSession()

gs::GraphDBSession::GraphDBSession ( GraphDB db,
Allocator alloc,
WalWriter logger,
const std::string &  work_dir,
int  thread_id 
)
inline

◆ ~GraphDBSession()

gs::GraphDBSession::~GraphDBSession ( )
inline

Member Function Documentation

◆ BatchUpdate()

bool gs::GraphDBSession::BatchUpdate ( UpdateBatch batch)

◆ Compact()

bool gs::GraphDBSession::Compact ( )

◆ db()

const GraphDB & gs::GraphDBSession::db ( ) const

◆ Eval()

Result< std::vector< char > > gs::GraphDBSession::Eval ( const std::string &  input)

◆ eval_duration()

double gs::GraphDBSession::eval_duration ( ) const

◆ get_vertex_id_column()

std::shared_ptr< RefColumnBase > gs::GraphDBSession::get_vertex_id_column ( uint8_t  label) const

◆ get_vertex_property_column()

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

◆ GetApp()

AppBase * gs::GraphDBSession::GetApp ( int  idx)

◆ GetAppInfo()

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

◆ GetAppMetric()

const AppMetric & gs::GraphDBSession::GetAppMetric ( int  idx) const

◆ GetCompactTransaction()

CompactTransaction gs::GraphDBSession::GetCompactTransaction ( )

◆ GetInsertTransaction()

InsertTransaction gs::GraphDBSession::GetInsertTransaction ( )

◆ GetReadTransaction()

ReadTransaction gs::GraphDBSession::GetReadTransaction ( ) const

◆ GetSingleEdgeInsertTransaction()

SingleEdgeInsertTransaction gs::GraphDBSession::GetSingleEdgeInsertTransaction ( )

◆ GetSingleVertexInsertTransaction()

SingleVertexInsertTransaction gs::GraphDBSession::GetSingleVertexInsertTransaction ( )

◆ GetUpdateTransaction()

UpdateTransaction gs::GraphDBSession::GetUpdateTransaction ( )

◆ graph() [1/2]

MutablePropertyFragment& gs::GraphDBSession::graph ( )

◆ graph() [2/2]

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

◆ parse_query_type()

Result<std::pair<uint8_t, std::string_view> > gs::GraphDBSession::parse_query_type ( const std::string &  input)
inlineprivate

Parse the input format of the query. There are four formats: 0. CppEncoder: This format will be used by interactive-sdk to submit c++ stored prcoedure queries. The second last byte is the query id.

  1. CypherJson: This format will be sended by interactive-sdk, the input is a json string + '\x01' { "query_name": "example", "arguments": { "value": 1, "type": { "primitive_type": "DT_SIGNED_INT32" } } }
  2. CypherInternalAdhoc: This format will be used by compiler to submit adhoc query, the input is a string + '\x02', the string is the path to the dynamic library.
  3. CypherInternalProcedure: This format will be used by compiler to submit procedure query, the input is a proto-encoded string + '\x03', the string is the path to the dynamic library.
    Parameters
    inputThe input query.
    Returns
    The id of the query and a string_view which contains the real input of the query, discard the input format and query type.

◆ parse_query_type_from_cypher_internal()

Result< std::pair< uint8_t, std::string_view > > gs::GraphDBSession::parse_query_type_from_cypher_internal ( const std::string_view &  input)
private

◆ parse_query_type_from_cypher_json()

Result< std::pair< uint8_t, std::string_view > > gs::GraphDBSession::parse_query_type_from_cypher_json ( const std::string_view &  input)
private

◆ query_num()

int64_t gs::GraphDBSession::query_num ( ) const

◆ schema()

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

◆ SessionId()

int gs::GraphDBSession::SessionId ( ) const

Member Data Documentation

◆ alloc_

Allocator& gs::GraphDBSession::alloc_
private

◆ app_metrics_

std::array<AppMetric, MAX_PLUGIN_NUM> gs::GraphDBSession::app_metrics_
private

◆ app_wrappers_

std::array<AppWrapper, MAX_PLUGIN_NUM> gs::GraphDBSession::app_wrappers_
private

◆ apps_

std::array<AppBase*, MAX_PLUGIN_NUM> gs::GraphDBSession::apps_
private

◆ db_

GraphDB& gs::GraphDBSession::db_
private

◆ eval_duration_

std::atomic<int64_t> gs::GraphDBSession::eval_duration_
private

◆ kCppEncoderStr

constexpr const char* gs::GraphDBSession::kCppEncoderStr = "\x00"
staticconstexpr

◆ kCypherJsonStr

constexpr const char* gs::GraphDBSession::kCypherJsonStr = "\x01"
staticconstexpr

◆ kCypherProtoAdhocStr

constexpr const char* gs::GraphDBSession::kCypherProtoAdhocStr = "\x02"
staticconstexpr

◆ kCypherProtoProcedureStr

constexpr const char* gs::GraphDBSession::kCypherProtoProcedureStr = "\x03"
staticconstexpr

◆ logger_

WalWriter& gs::GraphDBSession::logger_
private

◆ MAX_PLUGIN_NUM

constexpr int32_t gs::GraphDBSession::MAX_PLUGIN_NUM = 256
staticconstexpr

◆ MAX_RETRY

constexpr int32_t gs::GraphDBSession::MAX_RETRY = 3
staticconstexpr

◆ query_num_

std::atomic<int64_t> gs::GraphDBSession::query_num_
private

◆ thread_id_

int gs::GraphDBSession::thread_id_
private

◆ work_dir_

std::string gs::GraphDBSession::work_dir_
private

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