metadata

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(suffix *regexp.Regexp, factory Factory)

Register registers new Factory with corresponding suffix regexp.

Types

type Factory

type Factory interface {
	Create(suffix string) Metadata
}

Factory creates Metadata objects given suffix.

type LastAccessTime

type LastAccessTime struct {
	Time time.Time
}

LastAccessTime tracks a file's last access time.

func NewLastAccessTime

func NewLastAccessTime(t time.Time) *LastAccessTime

NewLastAccessTime creates a LastAccessTime from t.

func (*LastAccessTime) Deserialize

func (t *LastAccessTime) Deserialize(b []byte) error

Deserialize loads b into t.

func (*LastAccessTime) GetSuffix

func (t *LastAccessTime) GetSuffix() string

GetSuffix returns the metadata suffix.

func (*LastAccessTime) Movable

func (t *LastAccessTime) Movable() bool

Movable is true.

func (*LastAccessTime) Serialize

func (t *LastAccessTime) Serialize() ([]byte, error)

Serialize converts t to bytes.

type Metadata

type Metadata interface {
	GetSuffix() string
	Movable() bool
	Serialize() ([]byte, error)
	Deserialize([]byte) error
}

Metadata defines types of matadata file. All implementations of Metadata must register themselves.

func CreateFromSuffix

func CreateFromSuffix(suffix string) Metadata

CreateFromSuffix creates a Metadata obj based on suffix. This is not a very efficient method; It's mostly used during reload.

Jump to

Keyboard shortcuts

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