Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Decouple client.DB from net #2768

11 changes: 8 additions & 3 deletions client/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ type DB interface {
// can safely operate on it concurrently.
NewConcurrentTxn(context.Context, bool) (datastore.Txn, error)

// Root returns the underlying root store, within which all data managed by DefraDB is held.
Root() datastore.RootStore
// Rootstore returns the underlying root store, within which all data managed by DefraDB is held.
Rootstore() datastore.Rootstore

// Blockstore returns the blockstore, within which all blocks (commits) managed by DefraDB are held.
//
// It sits within the rootstore returned by [Root].
Blockstore() datastore.DAGStore
Blockstore() datastore.Blockstore

// Peerstore returns the peerstore where known host information is stored.
//
Expand Down Expand Up @@ -106,6 +106,11 @@ type Store interface {
// Backup holds the backup related methods that must be implemented by the database.
Backup

// P2P contains functions related to the P2P system.
//
// These functions are only useful if there is a configured network peer.
P2P

// AddSchema takes the provided GQL schema in SDL format, and applies it to the [Store],
// creating the necessary collections, request types, etc.
//
Expand Down
1 change: 1 addition & 0 deletions client/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ var (
ErrCanNotNormalizeValue = errors.New(errCanNotNormalizeValue)
ErrCanNotTurnNormalValueIntoArray = errors.New(errCanNotTurnNormalValueIntoArray)
ErrCanNotMakeNormalNilFromFieldKind = errors.New(errCanNotMakeNormalNilFromFieldKind)
ErrCollectionNotFound = errors.New(errCollectionNotFound)
)

// NewErrFieldNotExist returns an error indicating that the given field does not exist.
Expand Down
Loading
Loading