takedata

package
v0.0.0-...-902f68f Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2015 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExistsError

type ExistsError struct {
	ID ID
}

ExistsError is returned when CreateTake is attempted with an existing ID.

func (*ExistsError) Error

func (e *ExistsError) Error() string

type ID

type ID struct {
	Scene string `json:"scene"`
	Num   string `json:"num"`
}

ID is a unique identifier for a take.

func (ID) Less

func (id1 ID) Less(id2 ID) bool

Less reports whether id1 is less than id2.

func (ID) String

func (id ID) String() string

type NotFoundError

type NotFoundError struct {
	ID ID
}

NotFoundError is returned when a Storage method fails to find a take.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type Storage

type Storage interface {
	// ListTakes returns a sorted list of all takes in the storage.
	// The returned takes should not be modified.
	ListTakes() ([]*Take, error)

	// GetTake retrieves a take with the given ID.
	// The returned takes should not be modified.
	GetTake(id ID) (*Take, error)

	// InsertTake adds a new take.
	InsertTake(take *Take) error

	// UpdateTake updates an existing take.
	UpdateTake(id ID, take *Take) error

	// DeleteTake deletes a single take.
	DeleteTake(id ID) error

	// Close flushes the storage to disk.
	Close() error
}

Storage provides a database of takes. Calls to ListTakes and GetTake from multiple goroutines are safe, as long as they do not happen concurrently any other calls.

func NewCSVStorage

func NewCSVStorage(rw io.ReadWriter) (Storage, error)

NewCSVStorage creates a CSV-file-backed storage from rw. rw is first read to get the initial contents, then mutations are written afterward. No attempt is made to deduplicate records.

func NewMemoryStorage

func NewMemoryStorage() Storage

NewMemoryStorage returns a new in-memory storage.

type Take

type Take struct {
	ID       ID     `json:"id"`
	ClipName string `json:"clipName,omitempty"`
	Select   bool   `json:"select"`
}

Take represents a single video clip.

Jump to

Keyboard shortcuts

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