datastore

package
v0.0.0-...-40caa79 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Path string
}

Config is the datastore config

type Datastore

type Datastore struct {
	Cfg Config
	// contains filtered or unexported fields
}

Datastore is the default implementation of a Datastorer.

func Open

func Open(cfg Config) (*Datastore, error)

Open opens the default datastore and preps it for transactions.

func (*Datastore) Add

func (d *Datastore) Add(col string, fp []byte, name string, data map[string][]byte) error

Add adds file data to the set of file data associated with this fingerprint.

func (*Datastore) Close

func (d *Datastore) Close() error

Close closes the default datastore.

func (*Datastore) Get

func (d *Datastore) Get(col string, fp []byte) (map[string]map[string][]byte, error)

Get gets the set of file data associated with this fingerprint.

func (*Datastore) GetFingerPrints

func (d *Datastore) GetFingerPrints(col string) [][]byte

GetFingerPrints gets the fingerprints

func (*Datastore) GetImages

func (d *Datastore) GetImages(col string, fp []byte) []string

GetImages gets the images associated with a fingerprint

func (*Datastore) Remove

func (d *Datastore) Remove(col string, fp []byte, name string) error

Remove removes a particular file from the set of files associated with this fingerprint.

type Datastorer

type Datastorer interface {
	// Open opens the datastore for reading and writing.
	Open(Config) (*Datastore, error)

	// Close closes the datastore; no further transactions will be completed.
	Close() error

	// Get gets the set of fileData that has the same fingerprint.
	Get(collection string, fingerprint []byte) (map[string]map[string][]byte, error)

	// Add adds a file data for a fingerprint.
	Add(collection string, fingerprint []byte, filename string, data map[string][]byte) error

	// Remove removes a file from the set of files for this fingerprint.
	Remove(collection string, fingerprint []byte, filename string) error
}

Datastorer stores image fingerprints and their associated context data like filename and path.

Jump to

Keyboard shortcuts

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