Documentation ¶
Index ¶
- type Driver
- func (t *Driver) CreateDirectory(ctx context.Context, d *v1.Directory) (*v1.Directory, error)
- func (t *Driver) CreateRoot(ctx context.Context, d *v1.Directory) (*v1.Directory, error)
- func (t *Driver) DeleteDirectory(ctx context.Context, id v1.DirectoryID) ([]*v1.Directory, error)
- func (t *Driver) GetChildren(ctx context.Context, parent v1.DirectoryID, options ...storage.Option) ([]v1.DirectoryID, error)
- func (t *Driver) GetDirectory(ctx context.Context, id v1.DirectoryID, options ...storage.Option) (*v1.Directory, error)
- func (t *Driver) GetParents(ctx context.Context, child v1.DirectoryID, options ...storage.Option) ([]v1.DirectoryID, error)
- func (t *Driver) GetParentsUntilAncestor(ctx context.Context, child, ancestor v1.DirectoryID, options ...storage.Option) ([]v1.DirectoryID, error)
- func (t *Driver) ListRoots(ctx context.Context, options ...storage.Option) ([]v1.DirectoryID, error)
- func (t *Driver) UpdateDirectory(ctx context.Context, d *v1.Directory) error
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
func NewDirectoryDriver ¶ added in v0.0.2
func (*Driver) CreateDirectory ¶
CreateDirectory creates the provided directory.
func (*Driver) CreateRoot ¶
CreateRoot creates a root directory. Root directories are directories that have no parent directory. ID is generated by the database, it will be ignored if given.
func (*Driver) DeleteDirectory ¶ added in v0.0.4
DeleteDirectory soft deletes the provided directory id. If the provided directory has children, all child directories are soft deleted as well.
func (*Driver) GetChildren ¶
func (t *Driver) GetChildren( ctx context.Context, parent v1.DirectoryID, options ...storage.Option, ) ([]v1.DirectoryID, error)
GetChildren returns all children of the provided directory.
func (*Driver) GetDirectory ¶
func (t *Driver) GetDirectory( ctx context.Context, id v1.DirectoryID, options ...storage.Option, ) (*v1.Directory, error)
GetDirectoryByID returns a directory by its ID. Note that this call does not give out parent information.
func (*Driver) GetParents ¶
func (t *Driver) GetParents( ctx context.Context, child v1.DirectoryID, options ...storage.Option, ) ([]v1.DirectoryID, error)
GetParents returns all ids for each parent directory of the provided child id.
func (*Driver) GetParentsUntilAncestor ¶
func (t *Driver) GetParentsUntilAncestor( ctx context.Context, child, ancestor v1.DirectoryID, options ...storage.Option, ) ([]v1.DirectoryID, error)
GetParentsUntilAncestor returns all ids for each parent directory for the provided child until the provided ancestor is reached.
type Options ¶ added in v0.0.2
type Options func(*Driver)
Options defines ways to configure the CRDB driver.
func WithFastReads ¶ added in v0.0.2
func WithFastReads() Options
WithFastReads configures the driver to use fast reads. This is useful for read-only drivers. It will use a different query to read directories, which relies on follower reads. It is important to note that this query will not return the latest data, but it will return data that is consistent with the latest data.
func WithReadOnly ¶ added in v0.0.2
func WithReadOnly() Options
WithReadOnly configures the driver to be read-only.