metadata

package
v0.0.0-...-6ed8234 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package metadata contains types for managing custom metadata of files in the file system. Every file will be assigned an identifier and arbitrary metadata can be set on each file.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is the error returned when requested metadata
	// cannot be found.
	ErrNotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	Location string            `json:"location,omitempty"` // The file's location on the file system
	Values   map[string]string `json:"values,omitempty"`   // User metadata.
}

The Metadata type represents file metadata as stored within the metadata store.

type Store

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

The Store type contains methods for interacting with metadata storage. Metadata can be applied, updated & deleted from files using this type.

func Open

func Open(loc string, timeout time.Duration) (*Store, error)

Open a connection to the metadata store at the provided location. If connecting takes longer than the provided timeout it will be cancelled and an error is returned.

func (*Store) Delete

func (s *Store) Delete(loc string) error

Delete a file's metadata.

func (*Store) ForEach

func (s *Store) ForEach(fn func(md Metadata) error) error

ForEach iterates over each metadata record in the store and invokes 'fn'. If 'fn' returns an error it will cause iteration to stop.

func (*Store) Get

func (s *Store) Get(loc string) (Metadata, error)

Get metadata for a file

func (*Store) Set

func (s *Store) Set(md Metadata) (Metadata, error)

Set metadata for a file.

Jump to

Keyboard shortcuts

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