Documentation ¶
Overview ¶
named is a utility for dealing with named fiddles.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
DuplicateNameErr = errors.New("Name already exists.")
)
Functions ¶
This section is empty.
Types ¶
type NameStore ¶
type NameStore interface { GetHashFromName(name string) (string, error) WriteName(name, hash, user, status string) error }
NameStore is an interface that store.Store conforms to that is just the methods that Named uses.
type Named ¶
type Named struct {
// contains filtered or unexported fields
}
Named deals with creating and dereferencing named fiddles.
func (*Named) Add ¶
Add a named fiddle.
name - The name of the fidde, w/o the @ prefix. hash - The fiddle hash. user - The email of the user that created the name. overwrite - True if the write should proceed if the name already exists.
func (*Named) DereferenceID ¶
Dereference converts the id to a fiddlehash, where id could be either a fiddle name or a fiddle hash. Fiddle names are presumed to be prefixed with "@".
Returns an error if the fiddle hash is not valid looking.
func (*Named) DereferenceImageID ¶
DereferenceImageID converts the id of an image to the fiddle hash and the Media it represents, handling both original fiddle hashes and fiddle names as part of the image id. Fiddle names are presumed to be prefixed with "@".
I.e. it converts "cbb8dee39e9f1576cd97c2d504db8eee_gpu.png" to "cbb8dee39e9f1576cd97c2d504db8eee" and store.GPU. and, could also convert "@star_raster.png" to "cbb8dee39e9f1576cd97c2d504db8eee" and store.CPU.