index

package
v2.19.7 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Autoincrement

type Autoincrement struct {
	// contains filtered or unexported fields
}

Autoincrement are fields for an index of type autoincrement.

func (*Autoincrement) Add

func (idx *Autoincrement) Add(id, v string) (string, error)

Add a new value to the index.

func (*Autoincrement) CaseInsensitive

func (idx *Autoincrement) CaseInsensitive() bool

CaseInsensitive undocumented.

func (*Autoincrement) Delete

func (idx *Autoincrement) Delete() error

Delete deletes the index folder from its storage.

func (*Autoincrement) FilesDir

func (idx *Autoincrement) FilesDir() string

FilesDir undocumented.

func (*Autoincrement) IndexBy

func (idx *Autoincrement) IndexBy() option.IndexBy

IndexBy undocumented.

func (*Autoincrement) Init

func (idx *Autoincrement) Init() error

Init initializes an autoincrement index.

func (*Autoincrement) Lookup

func (idx *Autoincrement) Lookup(v string) ([]string, error)

Lookup exact lookup by value.

func (*Autoincrement) LookupCtx added in v2.7.0

func (idx *Autoincrement) LookupCtx(ctx context.Context, values ...string) ([]string, error)

LookupCtx retieves multiple exact values and allows passing in a context

func (*Autoincrement) Remove

func (idx *Autoincrement) Remove(_ string, v string) error

Remove a value v from an index.

func (*Autoincrement) Search

func (idx *Autoincrement) Search(pattern string) ([]string, error)

Search allows for glob search on the index.

func (*Autoincrement) TypeName

func (idx *Autoincrement) TypeName() string

TypeName undocumented.

func (*Autoincrement) Update

func (idx *Autoincrement) Update(id, oldV, newV string) error

Update index from <oldV> to <newV>.

type Index

type Index interface {
	Init() error
	Lookup(v string) ([]string, error)
	LookupCtx(ctx context.Context, v ...string) ([]string, error)
	Add(id, v string) (string, error)
	Remove(id string, v string) error
	Update(id, oldV, newV string) error
	Search(pattern string) ([]string, error)
	CaseInsensitive() bool
	IndexBy() option.IndexBy
	TypeName() string
	FilesDir() string
	Delete() error // Delete deletes the index folder from its storage.
}

Index can be implemented to create new indexer-strategies. See Unique for example. Each indexer implementation is bound to one data-column (IndexBy) and a data-type (TypeName)

func NewAutoincrementIndex

func NewAutoincrementIndex(storage metadata.Storage, o ...option.Option) Index

NewAutoincrementIndex instantiates a new AutoincrementIndex instance.

func NewNonUniqueIndexWithOptions

func NewNonUniqueIndexWithOptions(storage metadata.Storage, o ...option.Option) Index

NewNonUniqueIndexWithOptions instantiates a new NonUniqueIndex instance. /tmp/ocis/accounts/index.cs3/Pets/Bro* ├── Brown/ │ └── rebef-123 -> /tmp/testfiles-395764020/pets/rebef-123 ├── Green/ │ ├── goefe-789 -> /tmp/testfiles-395764020/pets/goefe-789 │ └── xadaf-189 -> /tmp/testfiles-395764020/pets/xadaf-189 └── White/ | └── wefwe-456 -> /tmp/testfiles-395764020/pets/wefwe-456

func NewUniqueIndexWithOptions

func NewUniqueIndexWithOptions(storage metadata.Storage, o ...option.Option) Index

NewUniqueIndexWithOptions instantiates a new UniqueIndex instance. Init() should be called afterward to ensure correct on-disk structure.

type NonUnique

type NonUnique struct {
	// contains filtered or unexported fields
}

NonUnique are fields for an index of type non_unique.

func (*NonUnique) Add

func (idx *NonUnique) Add(id, v string) (string, error)

Add a new value to the index.

func (*NonUnique) CaseInsensitive

func (idx *NonUnique) CaseInsensitive() bool

CaseInsensitive undocumented.

func (*NonUnique) Delete

func (idx *NonUnique) Delete() error

Delete deletes the index folder from its storage.

func (*NonUnique) FilesDir

func (idx *NonUnique) FilesDir() string

FilesDir undocumented.

func (*NonUnique) IndexBy

func (idx *NonUnique) IndexBy() option.IndexBy

IndexBy undocumented.

func (*NonUnique) Init

func (idx *NonUnique) Init() error

Init initializes a non_unique index.

func (*NonUnique) Lookup

func (idx *NonUnique) Lookup(v string) ([]string, error)

Lookup exact lookup by value.

func (*NonUnique) LookupCtx added in v2.7.0

func (idx *NonUnique) LookupCtx(ctx context.Context, values ...string) ([]string, error)

LookupCtx retieves multiple exact values and allows passing in a context

func (*NonUnique) Remove

func (idx *NonUnique) Remove(id string, v string) error

Remove a value v from an index.

func (*NonUnique) Search

func (idx *NonUnique) Search(pattern string) ([]string, error)

Search allows for glob search on the index.

func (*NonUnique) TypeName

func (idx *NonUnique) TypeName() string

TypeName undocumented.

func (*NonUnique) Update

func (idx *NonUnique) Update(id, oldV, newV string) error

Update index from <oldV> to <newV>.

type Unique

type Unique struct {
	// contains filtered or unexported fields
}

Unique are fields for an index of type unique.

func (*Unique) Add

func (idx *Unique) Add(id, v string) (string, error)

Add adds a value to the index, returns the path to the root-document

func (*Unique) CaseInsensitive

func (idx *Unique) CaseInsensitive() bool

CaseInsensitive undocumented.

func (*Unique) Delete

func (idx *Unique) Delete() error

Delete deletes the index folder from its storage.

func (*Unique) FilesDir

func (idx *Unique) FilesDir() string

FilesDir undocumented.

func (*Unique) IndexBy

func (idx *Unique) IndexBy() option.IndexBy

IndexBy undocumented.

func (*Unique) Init

func (idx *Unique) Init() error

Init initializes a unique index.

func (*Unique) Lookup

func (idx *Unique) Lookup(v string) ([]string, error)

Lookup exact lookup by value.

func (*Unique) LookupCtx added in v2.7.0

func (idx *Unique) LookupCtx(ctx context.Context, values ...string) ([]string, error)

LookupCtx retieves multiple exact values and allows passing in a context

func (*Unique) Remove

func (idx *Unique) Remove(_ string, v string) error

Remove a value v from an index.

func (*Unique) Search

func (idx *Unique) Search(pattern string) ([]string, error)

Search allows for glob search on the index.

func (*Unique) TypeName

func (idx *Unique) TypeName() string

TypeName undocumented.

func (*Unique) Update

func (idx *Unique) Update(id, oldV, newV string) error

Update index from <oldV> to <newV>.

Jump to

Keyboard shortcuts

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