A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
a11::stores::SQLiteChunkStoreFactory Class Reference

Creates SQLiteChunkStores rooted at one directory. More...

#include <cpp/a11/stores/sqlite_chunk_store.h>

Public Member Functions

absl::StatusOr< std::shared_ptr< SQLiteChunkStore > > Open (std::string node_id)
 Open a store for node_id under this factory's root.
 
std::string root () const
 The root this factory creates stores under.
 
const SQLiteChunkStoreOptions & options () const
 The validated storage policy applied to every store created here.
 
a11::Future< size_t > SweepOrphanBlobs ()
 Delete unreferenced blob files older than the configured grace period.
 
 SQLiteChunkStoreFactory (ConstructorToken, std::shared_ptr< internal::SqliteDatabase > database, SQLiteChunkStoreOptions options)
 

Static Public Member Functions

static absl::StatusOr< std::shared_ptr< SQLiteChunkStoreFactory > > Create (const std::string &root, SQLiteChunkStoreOptions options)
 Create a factory rooted at root with an explicit policy.
 
static absl::StatusOr< std::shared_ptr< SQLiteChunkStoreFactory > > Create (const std::string &root)
 Create a factory rooted at root with the environment/default policy.
 
static absl::StatusOr< std::shared_ptr< SQLiteChunkStoreFactory > > Create ()
 Create a factory at the default root with the environment/default policy.
 
static std::string DefaultRoot ()
 The process-wide default storage root.
 

Detailed Description

Creates SQLiteChunkStores rooted at one directory.

Stores are cheap; the database behind them is not. The factory holds the shared per-root database so that every store it creates reuses one set of connections, worker threads and change hooks. Pass AsChunkStoreFactory() to a NodeMap or AsyncNode to make SQLite the default backing store.

Constructor & Destructor Documentation

◆ SQLiteChunkStoreFactory()

a11::stores::SQLiteChunkStoreFactory::SQLiteChunkStoreFactory ( ConstructorToken  ,
std::shared_ptr< internal::SqliteDatabase >  database,
SQLiteChunkStoreOptions  options 
)
inline

Member Function Documentation

◆ Create() [1/3]

absl::StatusOr< std::shared_ptr< SQLiteChunkStoreFactory > > a11::stores::SQLiteChunkStoreFactory::Create ( )
static

Create a factory at the default root with the environment/default policy.

◆ Create() [2/3]

absl::StatusOr< std::shared_ptr< SQLiteChunkStoreFactory > > a11::stores::SQLiteChunkStoreFactory::Create ( const std::string &  root)
static

Create a factory rooted at root with the environment/default policy.

◆ Create() [3/3]

absl::StatusOr< std::shared_ptr< SQLiteChunkStoreFactory > > a11::stores::SQLiteChunkStoreFactory::Create ( const std::string &  root,
SQLiteChunkStoreOptions  options 
)
static

Create a factory rooted at root with an explicit policy.

Parameters
rootDirectory holding store.sqlite and blobs/; created when absent.
optionsStorage policy; per-root settings apply only on first open of that root.
Returns
The factory, or an error when the root or options are unusable.

◆ DefaultRoot()

std::string a11::stores::SQLiteChunkStoreFactory::DefaultRoot ( )
static

The process-wide default storage root.

$A11_SQLITE_CHUNK_STORE_ROOT when set, otherwise $XDG_CACHE_HOME/a11/chunks, otherwise ~/.cache/a11/chunks.

Returns
The default root path.

◆ Open()

absl::StatusOr< std::shared_ptr< SQLiteChunkStore > > a11::stores::SQLiteChunkStoreFactory::Open ( std::string  node_id)

Open a store for node_id under this factory's root.

Parameters
node_idThe node whose fragment log the store backs.
Returns
The store, or an error when the id is invalid.

◆ options()

const SQLiteChunkStoreOptions & a11::stores::SQLiteChunkStoreFactory::options ( ) const
inline

The validated storage policy applied to every store created here.

◆ root()

std::string a11::stores::SQLiteChunkStoreFactory::root ( ) const

The root this factory creates stores under.

◆ SweepOrphanBlobs()

a11::Future< size_t > a11::stores::SQLiteChunkStoreFactory::SweepOrphanBlobs ( )

Delete unreferenced blob files older than the configured grace period.


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