docstore

package
v0.0.0-...-18b8ac3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DocStore

type DocStore interface {
	Insert(context.Context, gollum.Document) error
	Retrieve(ctx context.Context, id string) (gollum.Document, error)
}

type MemoryDocStore

type MemoryDocStore struct {
	Documents map[string]gollum.Document
}

MemoryDocStore is a simple in-memory document store. It's functionally a hashmap / inverted-index.

func NewMemoryDocStore

func NewMemoryDocStore() *MemoryDocStore

func NewMemoryDocStoreFromDisk

func NewMemoryDocStoreFromDisk(ctx context.Context, bucket *blob.Bucket, path string) (*MemoryDocStore, error)

func (*MemoryDocStore) Insert

func (m *MemoryDocStore) Insert(ctx context.Context, d gollum.Document) error

Insert adds a node to the document store. It overwrites duplicates.

func (*MemoryDocStore) Load

func (m *MemoryDocStore) Load(ctx context.Context, bucket *blob.Bucket, path string) error

Load loads the document store from disk.

func (*MemoryDocStore) Persist

func (m *MemoryDocStore) Persist(ctx context.Context, bucket *blob.Bucket, path string) error

Persist saves the document store to disk.

func (*MemoryDocStore) Retrieve

func (m *MemoryDocStore) Retrieve(ctx context.Context, id string) (gollum.Document, error)

Retrieve returns a node from the document store matching an ID.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL