Documentation ¶
Index ¶
- Variables
- type BundleEngine
- type BundleStorage
- type Disk
- func (ds *Disk) Add(uri impl.Label, path []impl.Label, triples []igraph.Triple) error
- func (ds *Disk) AddChild(parent impl.Label, bundle string, child impl.Label) error
- func (ds *Disk) AddFieldValue(uri impl.Label, field string, value impl.Datum, language impl.Language, ...) error
- func (ds *Disk) Close() error
- func (ds *Disk) Count() (int64, error)
- func (ds *Disk) Finalize() error
- func (ds *Disk) Get(parentPathIndex int) iterator.Iterator[LabelWithParent]
- func (ds *Disk) Load(uri impl.Label) (entity wisski.Entity, err error)
- func (ds *Disk) RegisterChildStorage(bundle string, storage BundleStorage) error
- type DiskEngine
- type LabelWithParent
- type Memory
- func (bs *Memory) Add(uri impl.Label, path []impl.Label, triples []igraph.Triple) error
- func (bs *Memory) AddChild(parent impl.Label, bundle string, child impl.Label) error
- func (bs *Memory) AddFieldValue(uri impl.Label, field string, value impl.Datum, language impl.Language, ...) error
- func (bs *Memory) Close() error
- func (bs *Memory) Count() (int64, error)
- func (bs *Memory) Finalize() error
- func (bs *Memory) Get(parentPathIndex int) iterator.Iterator[LabelWithParent]
- func (bs *Memory) Load(uri impl.Label) (entity wisski.Entity, err error)
- func (bs *Memory) RegisterChildStorage(bundle string, storage BundleStorage) error
- type MemoryEngine
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNoEntity = errors.New("no such entity")
)
Functions ¶
This section is empty.
Types ¶
type BundleEngine ¶
type BundleEngine interface {
NewStorage(bundle *pathbuilder.Bundle) (BundleStorage, error)
}
BundleEngine is a function that initializes and returns a new BundleStorage
func NewBundleEngine ¶
func NewBundleEngine(path string) BundleEngine
NewBundleEngine creates a new BundleEngine backed by the disk at the provided path. If path is the empty string, return a memory-backed engine instead.
type BundleStorage ¶
type BundleStorage interface { io.Closer // Add adds a new entity with the given URI (and optional path information) // to this bundle. // // Calls to add for a specific bundle storage are serialized. Add(uri impl.Label, path []impl.Label, triples []igraph.Triple) error // AddFieldValue adds a value to the given field for the entity with the given uri. // lang corresponds to the language of the field being added. // // Concurrent calls to distinct fields may take place, however within each field calls are always synchronized. // // A non-existing parent should return ErrNoEntity. AddFieldValue(uri impl.Label, field string, value impl.Datum, lang impl.Language, path []impl.Label, triples []igraph.Triple) error // RegisterChildStorage register the given storage as a BundleStorage for the child bundle. // The Storage should delete the reference to the child storage when it is closed. RegisterChildStorage(bundle string, storage BundleStorage) error // AddChild adds a child entity of the given bundle to the given entity. // // Multiple concurrent calls to AddChild may take place, but every concurrent call will be for a different bundle. // // A non-existing parent should return ErrNoEntity. AddChild(parent impl.Label, bundle string, child impl.Label) error // Finalize is called to signal to this storage that no more write operations will take place. Finalize() error // Get returns an iterator that iterates over the url of every entity in this bundle, along with their parent URIs. // The iterator is guaranteed to iterate in some consistent order, but no further guarantees beyond that. // // parentPathIndex returns the index of the parent uri in child paths. Get(parentPathIndex int) iterator.Iterator[LabelWithParent] // Count counts the number of entities in this storage. Count() (int64, error) // Load loads an entity with the given URI from this storage. // A non-existing entity should return err = ErrNoEntity. Load(uri impl.Label) (wisski.Entity, error) }
BundleStorage is responsible for storing entities for a single bundle
type Disk ¶
Disk represents a disk-backed storage
func (*Disk) AddFieldValue ¶
func (*Disk) RegisterChildStorage ¶
func (ds *Disk) RegisterChildStorage(bundle string, storage BundleStorage) error
type DiskEngine ¶
type DiskEngine struct {
Path string
}
func (DiskEngine) NewStorage ¶
func (de DiskEngine) NewStorage(bundle *pathbuilder.Bundle) (BundleStorage, error)
type LabelWithParent ¶
LabelWithParent represents a URI along with it's parent
type Memory ¶
Memory implements an in-memory bundle storage
func (*Memory) AddFieldValue ¶
func (*Memory) RegisterChildStorage ¶
func (bs *Memory) RegisterChildStorage(bundle string, storage BundleStorage) error
type MemoryEngine ¶
type MemoryEngine struct{}
func (MemoryEngine) NewStorage ¶
func (MemoryEngine) NewStorage(bundle *pathbuilder.Bundle) (BundleStorage, error)
Click to show internal directories.
Click to hide internal directories.