Documentation ¶
Index ¶
- Constants
- Variables
- func MakePreview(img image.Image) image.Image
- func MatchName(str string) bool
- func MatchURL(str string) bool
- func TagTypeAllowed(str string) bool
- type Image
- type Info
- type Store
- func (s *Store) Close()
- func (s *Store) Image(hash string) Image
- func (s *Store) ImageAdd(data []byte, flake string) Image
- func (s *Store) ImageData(hash string, preview bool) (Image, []byte)
- func (s *Store) ImageDestroy(hash string)
- func (s *Store) ImageFilePath(hash string) string
- func (s *Store) ImageHasTag(flake, tag string) bool
- func (s *Store) ImageHashSplit(hash string) string
- func (s *Store) ImageHashTagsPath(hash string) string
- func (s *Store) ImageMetadataPath(hash string) string
- func (s *Store) ImageMetadataRead(path string) Image
- func (s *Store) ImagePath(hash string) string
- func (s *Store) ImagePreviewFilePath(hash string) string
- func (s *Store) ImageSearch(tags []string) []string
- func (s *Store) ImageSnowflake(flake string) Image
- func (s *Store) ImageSnowflakeHash(flake string) string
- func (s *Store) ImageSnowflakePath(flake string) string
- func (s *Store) ImageSnowflakes() []string
- func (s *Store) ImageTagAdd(flake, tag string)
- func (s *Store) ImageTagRemove(flake, tag string)
- func (s *Store) ImageTags(flake string) []string
- func (s *Store) ImageTagsPath(flake string) string
- func (s *Store) ImageUpdate(hash, source, parent, commentary, commentaryTranslation string)
- func (s *Store) Images() []string
- func (s *Store) ImagesDir() string
- func (s *Store) ImagesSnowflakeDir() string
- func (s *Store) LockPath() string
- func (s *Store) MatchName(str string) bool
- func (s *Store) MatchURL(str string) bool
- func (s *Store) Page(variant string, entry int) []string
- func (s *Store) PageBaseDir() string
- func (s *Store) PageImages(variant string, entry int) []Image
- func (s *Store) PageInsert(variant, flake string)
- func (s *Store) PageRegisterRemove(variant, flake string)
- func (s *Store) PageTotal(variant string) int
- func (s *Store) PageVariantPath(variant string) string
- func (s *Store) SecretAssociate(secret, flake string)
- func (s *Store) SecretDisassociate(secret string)
- func (s *Store) SecretLookup(secret string) User
- func (s *Store) SecretNew() string
- func (s *Store) SecretPath(secret string) string
- func (s *Store) SecretsDir() string
- func (s *Store) Tag(tag string) []string
- func (s *Store) TagCreate(tag string) bool
- func (s *Store) TagDestroy(tag string)
- func (s *Store) TagInfo(tag string) Tag
- func (s *Store) TagMetadataPath(tag string) string
- func (s *Store) TagPath(tag string) string
- func (s *Store) TagType(tag, t string)
- func (s *Store) Tags() []string
- func (s *Store) TagsDir() string
- func (s *Store) User(flake string) User
- func (s *Store) UserAdd(username, password string, privileged bool) User
- func (s *Store) UserDestroy(flake string)
- func (s *Store) UserImages(flake string) []string
- func (s *Store) UserImagesPath(flake string) string
- func (s *Store) UserMetadata(info User)
- func (s *Store) UserMetadataPath(flake string) string
- func (s *Store) UserPasswordPath(flake string) string
- func (s *Store) UserPasswordUpdate(flake, password string) bool
- func (s *Store) UserPasswordValidate(flake, password string) bool
- func (s *Store) UserPath(flake string) string
- func (s *Store) UserPrivileged(flake string, privileged bool)
- func (s *Store) UserSecretRegen(flake string) string
- func (s *Store) UserUsername(username string) User
- func (s *Store) UserUsernamePasswordValidate(username, password string) bool
- func (s *Store) UserUsernameUpdate(flake, username string) bool
- func (s *Store) UsernamePath(name string) string
- func (s *Store) UsernamesDir() string
- func (s *Store) Users() []string
- func (s *Store) UsersDir() string
- type Tag
- type User
Constants ¶
const ( UserSnowflakeNodeID = 7 ImageSnowflakeNodeID = 9 )
const ( // ArtistType is the tag type artist. ArtistType = "artist" // CharacterType is the tag type character. CharacterType = "character" // CopyrightType is the tag type copyright. CopyrightType = "copyright" // MetaType is the tag type meta. MetaType = "meta" // GenericType is the tag type generic. GenericType = "generic" )
const ImageRootPageVariant = "root"
const PageSize = 64
Variables ¶
var ( // AllowedTagTypes represent tag type strings that are allowed. AllowedTagTypes = []string{ArtistType, CharacterType, CopyrightType, MetaType, GenericType} )
Functions ¶
func MakePreview ¶ added in v1.4.0
MakePreview compresses an image.Image to preview-size.
func MatchName ¶ added in v1.3.2
MatchName determines if str is a valid name.
func MatchURL ¶ added in v1.3.2
MatchURL determines if str is a valid URL.
Types ¶
type Image ¶
type Image struct { Snowflake string `json:"snowflake"` Hash string `json:"hash"` Type string `json:"type"` User string `json:"user"` Source string `json:"source"` Parent string `json:"parent"` Child string `json:"child"` Commentary string `json:"commentary"` CommentaryTranslation string `json:"commentary_translation"` }
Image represents metadata of an image.
type Info ¶
type Info struct { Revision int `json:"revision"` Compat bool `json:"compat"` Register bool `json:"register"` InitialUser string `json:"initial_user"` PermissionDir os.FileMode `json:"permission_dir"` PermissionFile os.FileMode `json:"permission_file"` }
Info represents system information of a store.
type Store ¶
type Store struct { Path string SingleUser bool Private bool Revision int Compat bool Register bool InitialUser string PermissionDir os.FileMode PermissionFile os.FileMode sync.RWMutex // contains filtered or unexported fields }
Store represents a file store.
func (*Store) Image ¶
Image returns an image with specific hash.
func (*Store) ImageAdd ¶
ImageAdd adds an image to the store.
func (*Store) ImageData ¶
ImageData returns an image and its data with a specific hash.
func (*Store) ImageDestroy ¶
ImageDestroy destroys an image.
func (*Store) ImageFilePath ¶
ImageFilePath returns path to an image file with specific hash.
func (*Store) ImageHasTag ¶ added in v0.7.4
ImageHasTag figures out if an image has a tag.
func (*Store) ImageHashSplit ¶
ImageHashSplit returns split image hash.
func (*Store) ImageHashTagsPath ¶
ImageHashTagsPath returns path to an image's tags with specific hash.
func (*Store) ImageMetadataPath ¶
ImageMetadataPath returns path to an image's metadata file with specific hash.
func (*Store) ImageMetadataRead ¶
ImageMetadataRead reads an image metadata file.
func (*Store) ImagePath ¶
ImagePath returns path to an image with specific hash.
func (*Store) ImagePreviewFilePath ¶
ImagePreviewFilePath returns path to an image preview file with specific hash.
func (*Store) ImageSearch ¶ added in v0.7.4
ImageSearch searches for images with specific tags.
func (*Store) ImageSnowflake ¶
ImageSnowflake returns image that has specific snowflake.
func (*Store) ImageSnowflakeHash ¶
ImageSnowflakeHash returns image hash from snowflake.
func (*Store) ImageSnowflakePath ¶
ImageSnowflakePath returns path to an image with specific snowflake.
func (*Store) ImageSnowflakes ¶
ImageSnowflakes returns a slice of image snowflakes.
func (*Store) ImageTagAdd ¶
ImageTagAdd adds a tag to an image with specific snowflake.
func (*Store) ImageTagRemove ¶
ImageTagRemove removes a tag from an image with specific snowflake.
func (*Store) ImageTags ¶
ImageTags returns tags of an image with specific hash.
func (*Store) ImageTagsPath ¶
ImageTagsPath returns path to an image's tags with specific hash.
func (*Store) ImageUpdate ¶ added in v0.8.8
ImageUpdate updates image metadata.
func (*Store) ImagesSnowflakeDir ¶
ImagesSnowflakeDir returns path to image snowflakes.
func (*Store) MatchName ¶
MatchName determines if str is a valid name. As of v1, this just calls MatchName.
func (*Store) MatchURL ¶ added in v1.2.7
MatchURL determines if str is a valid URL. As of v1, this just calls MatchURL.
func (*Store) Page ¶
Page returns all entries in a page.
func (*Store) PageBaseDir ¶
PageBaseDir returns path to page base directory.
func (*Store) PageImages ¶
PageImages returns all images in a page.
func (*Store) PageInsert ¶
PageInsert inserts an image into the index.
func (*Store) PageRegisterRemove ¶
PageRegisterRemove registers an image remove.
func (*Store) PageTotal ¶
PageTotal returns total amount of pages.
func (*Store) PageVariantPath ¶
PageVariantPath returns path to pages of a variant.
func (*Store) SecretAssociate ¶
SecretAssociate associates a secret with a user.
func (*Store) SecretDisassociate ¶
SecretDisassociate disassociates a secret.
func (*Store) SecretLookup ¶
SecretLookup looks up a user from a secret.
func (*Store) SecretPath ¶
SecretPath returns path to tokens.
func (*Store) Tag ¶
Tag returns a slice of image snowflakes in a specific tag.
func (*Store) TagCreate ¶
TagCreate creates a tag and returns ok value.
func (*Store) TagDestroy ¶
TagDestroy removes all references from a tag and removes it.
func (*Store) TagInfo ¶
TagInfo returns information of a tag.
func (*Store) TagMetadataPath ¶
TagMetadataPath returns path to a specific tag's metadata file.
func (*Store) TagPath ¶
TagPath returns path to a specific tag.
func (*Store) User ¶
User returns user information with specific snowflake.
func (*Store) UserAdd ¶
UserAdd creates a user.
func (*Store) UserDestroy ¶
UserDestroy destroys a user with specific snowflake.
func (*Store) UserImages ¶
UserImages returns slice of a user's images.
func (*Store) UserImagesPath ¶
UserImagesPath returns path to a user's images with specific snowflake.
func (*Store) UserMetadata ¶
UserMetadata sets user metadata.
func (*Store) UserMetadataPath ¶
UserMetadataPath returns path to a user's metadata file with specific snowflake.
func (*Store) UserPasswordPath ¶
UserPasswordPath returns path to a user's password.
func (*Store) UserPasswordUpdate ¶
UserPasswordUpdate updates password of specified user.
func (*Store) UserPasswordValidate ¶
UserPasswordValidate validates password of specified user.
func (*Store) UserPath ¶
UserPath returns path to a user with specific snowflake.
func (*Store) UserPrivileged ¶
UserPrivileged sets privileged status of user with specific snowflake.
func (*Store) UserSecretRegen ¶
UserSecretRegen regenerates secret of user with specific snowflake.
func (*Store) UserUsername ¶
UserUsername returns user via username.
func (*Store) UserUsernamePasswordValidate ¶
UserUsernamePasswordValidate validates password of specified user from username.
func (*Store) UserUsernameUpdate ¶
UserUsernameUpdate updates username of user with specific snowflake.
func (*Store) UsernamePath ¶
UsernamePath returns path to username.
func (*Store) UsernamesDir ¶
UsernamesDir returns path to usernames.
type Tag ¶
Tag represents metadata of a tag.