Documentation
¶
Overview ¶
Package catalogfake is an in-memory catalog.Store for tests of the code that writes curation (#1920): it keeps the contract the PostgreSQL store keeps, so a test that passes against it is not passing against a looser store.
Index ¶
- type Store
- func (f *Store) AddDataset(connection, path string, columns ...string) catalog.Ref
- func (*Store) AddEdges(context.Context, []catalog.Edge) error
- func (f *Store) Aspects(ref catalog.Ref) catalog.Aspects
- func (*Store) Browse(context.Context, catalog.BrowseQuery) ([]catalog.BrowseEntry, error)
- func (f *Store) DatasetsByPath(_ context.Context, connectionKind, path string) ([]string, error)
- func (f *Store) DeleteDefinition(ctx context.Context, ref catalog.Ref) error
- func (f *Store) GetDataset(_ context.Context, ref catalog.Ref) (*catalog.Dataset, error)
- func (f *Store) GetDefinition(_ context.Context, ref catalog.Ref) (*catalog.Definition, error)
- func (f *Store) History(_ context.Context, ref catalog.Ref, name catalog.AspectName) ([]catalog.Change, error)
- func (*Store) Lineage(context.Context, string, catalog.Direction, int) ([]catalog.Hop, error)
- func (f *Store) ListDefinitions(_ context.Context, q catalog.DefinitionQuery) ([]catalog.DefinitionSummary, error)
- func (*Store) MarkDatasetRemoved(context.Context, catalog.Ref) error
- func (*Store) MarkRemoved(context.Context, catalog.Removal) (int, error)
- func (*Store) PutDataset(context.Context, catalog.DatasetInput) (*catalog.Dataset, error)
- func (f *Store) PutDefinition(_ context.Context, in catalog.DefinitionInput) (*catalog.Definition, error)
- func (f *Store) RevertChanges(_ context.Context, ids []string, by string) ([]catalog.Change, error)
- func (f *Store) Rollback(ctx context.Context, changeID, by string) (*catalog.Change, error)
- func (*Store) SearchDatasets(context.Context, catalog.DatasetQuery) ([]catalog.DatasetSummary, error)
- func (f *Store) SetBeforeWrite(fn func())
- func (f *Store) SetDescription(ref, description string)
- func (f *Store) TaggedEntities(_ context.Context, tag string, limit int) ([]string, error)
- func (f *Store) Uses(_ context.Context, ref catalog.Ref, limit int) ([]catalog.Use, error)
- func (f *Store) WriteAspect(ctx context.Context, ref catalog.Ref, name catalog.AspectName, ...) (*catalog.Change, error)
- func (f *Store) WriteAspects(_ context.Context, edits []catalog.AspectEdit, by string) ([]catalog.Change, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// FailWrite, when set, fails every write before anything is applied.
FailWrite error
// contains filtered or unexported fields
}
Store is an in-memory catalog.Store holding the contract the PostgreSQL store keeps: every write is versioned per aspect with the value it replaced, WriteAspects and RevertChanges are all-or-nothing, a revert refuses a change its aspect was written after, and a value is normalized as the store normalizes it.
func (*Store) AddDataset ¶
AddDataset stores a Trino dataset with the given columns and returns its reference.
func (*Store) Browse ¶
func (*Store) Browse(context.Context, catalog.BrowseQuery) ([]catalog.BrowseEntry, error)
Browse implements catalog.Store; the fake holds no browsable levels.
func (*Store) DatasetsByPath ¶
DatasetsByPath implements catalog.Store.
func (*Store) DeleteDefinition ¶
DeleteDefinition implements catalog.Store, refusing a definition anything carries as the PostgreSQL store does.
func (*Store) GetDataset ¶
GetDataset implements catalog.Store.
func (*Store) GetDefinition ¶
GetDefinition implements catalog.Store.
func (*Store) History ¶
func (f *Store) History(_ context.Context, ref catalog.Ref, name catalog.AspectName) ([]catalog.Change, error)
History implements catalog.Store.
func (*Store) ListDefinitions ¶
func (f *Store) ListDefinitions(_ context.Context, q catalog.DefinitionQuery) ([]catalog.DefinitionSummary, error)
ListDefinitions implements catalog.Store: the definitions of the kinds asked for, under the parent asked for, ordered by name. Text is ignored.
func (*Store) MarkDatasetRemoved ¶
MarkDatasetRemoved implements catalog.Store.
func (*Store) MarkRemoved ¶
MarkRemoved implements catalog.Store.
func (*Store) PutDataset ¶
PutDataset implements catalog.Store.
func (*Store) PutDefinition ¶
func (f *Store) PutDefinition(_ context.Context, in catalog.DefinitionInput) (*catalog.Definition, error)
PutDefinition implements catalog.Store.
func (*Store) RevertChanges ¶
RevertChanges implements catalog.Store.
func (*Store) SearchDatasets ¶
func (*Store) SearchDatasets(context.Context, catalog.DatasetQuery) ([]catalog.DatasetSummary, error)
SearchDatasets implements catalog.Store.
func (*Store) SetBeforeWrite ¶
func (f *Store) SetBeforeWrite(fn func())
SetBeforeWrite has the next WriteAspects run fn before it checks anything, so a test can land a concurrent write between a plan's read and its write.
func (*Store) SetDescription ¶
SetDescription stores a description on the entity ref names, as curation written before the test.
func (*Store) TaggedEntities ¶
TaggedEntities implements catalog.Store.
func (*Store) WriteAspect ¶
func (f *Store) WriteAspect(ctx context.Context, ref catalog.Ref, name catalog.AspectName, value json.RawMessage, by string) (*catalog.Change, error)
WriteAspect implements catalog.Store.