disk

package
v0.0.0-...-499b85e Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAutoincrementIndex

func NewAutoincrementIndex(o ...option.Option) index.Index

NewAutoincrementIndex instantiates a new AutoincrementIndex instance. Init() MUST be called upon instantiation.

func NewNonUniqueIndexWithOptions

func NewNonUniqueIndexWithOptions(o ...option.Option) index.Index

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

func NewUniqueIndexWithOptions

func NewUniqueIndexWithOptions(o ...option.Option) index.Index

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

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 root folder from the configured storage.

func (*Autoincrement) FilesDir

func (idx *Autoincrement) FilesDir() string

FilesDir undocumented.

func (*Autoincrement) IndexBy

func (idx *Autoincrement) IndexBy() string

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) Remove

func (idx *Autoincrement) Remove(id 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 NonUnique

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

NonUnique is able to index an document by a key which might contain non-unique values

/var/tmp/testfiles-395764020/index.disk/PetByColor/ ├── Brown │ └── rebef-123 -> /var/tmp/testfiles-395764020/pets/rebef-123 ├── Green │ ├── goefe-789 -> /var/tmp/testfiles-395764020/pets/goefe-789 │ └── xadaf-189 -> /var/tmp/testfiles-395764020/pets/xadaf-189 └── White

└── wefwe-456 -> /var/tmp/testfiles-395764020/pets/wefwe-456

func (*NonUnique) Add

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

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

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() string

IndexBy undocumented.

func (*NonUnique) Init

func (idx *NonUnique) Init() error

Init initializes a unique index.

func (*NonUnique) Lookup

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

Lookup exact lookup by value.

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) (err error)

Update index from <oldV> to <newV>.

type Unique

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

Unique ensures that only one document of the same type and key-value combination can exist in the index.

Modeled by creating a indexer-folder per entity and key with symlinks which point to respective documents which contain the link-filename as value.

Directory Layout

/var/data/index.disk/UniqueUserByEmail/
├── jacky@example.com -> /var/data/users/ewf4ofk-555
├── jones@example.com -> /var/data/users/rulan54-777
└── mikey@example.com -> /var/data/users/abcdefg-123

Example user

		{
 		"Id": "ewf4ofk-555",
 		"UserName": "jacky",
 		"Email": "jacky@example.com"
		}

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() string

IndexBy undocumented.

func (*Unique) Init

func (idx *Unique) Init() error

Init initializes a unique index.

func (*Unique) Lookup

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

Lookup exact lookup by value.

func (*Unique) Remove

func (idx *Unique) Remove(id string, v string) (err 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) (err 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