Documentation ¶
Index ¶
- Variables
- type BundleMeta
- type GCloudStorageImpl
- func (s *GCloudStorageImpl) CreateTag(bundleMeta *BundleMeta, sha512, tag string) error
- func (s *GCloudStorageImpl) DeleteTag(bundleMeta *BundleMeta, tag string) error
- func (s *GCloudStorageImpl) GetBundle(bundleMeta *BundleMeta, sha512 string) (io.ReadCloser, error)
- func (s *GCloudStorageImpl) GetBundleOwner(bundleID string) (*BundleMeta, error)
- func (s *GCloudStorageImpl) GetRevisionForTag(bundleMeta *BundleMeta, tag string) (string, error)
- func (s *GCloudStorageImpl) GetRevisions(bundleMeta *BundleMeta, cursor string, pageSize int) ([]*Revision, string, error)
- func (s *GCloudStorageImpl) GetTags(bundleMeta *BundleMeta, cursor string, pageSize int) ([]*Tag, string, error)
- func (s *GCloudStorageImpl) SaveBundle(bytes io.Reader, bundleMeta *BundleMeta) (string, error)
- type Revision
- type Storage
- type Tag
Constants ¶
This section is empty.
Variables ¶
var ( //ErrRevisionNotExist returned when a revision does not exist ErrRevisionNotExist = errors.New("Revision in bucket does not exist") //ErrTagNotExist returned when a tag does not exist ErrTagNotExist = errors.New("Requested tag in bundle does not exist") //ErrNotAllowed The user is not allowed to access this bundle ErrNotAllowed = errors.New("The user is not allowed to access this bundle") )
Functions ¶
This section is empty.
Types ¶
type BundleMeta ¶
type BundleMeta struct { //The bundle name BundleID string //The creator's userID from their JWT token OwnerUserID string }
BundleMeta the owner of the bundle
type GCloudStorageImpl ¶
type GCloudStorageImpl struct { Bucket *storage.BucketHandle DsClient *datastore.Client Context context.Context }
GCloudStorageImpl The google cloud storage implementation
func (*GCloudStorageImpl) CreateTag ¶
func (s *GCloudStorageImpl) CreateTag(bundleMeta *BundleMeta, sha512, tag string) error
CreateTag create a tag for the bundle id
func (*GCloudStorageImpl) DeleteTag ¶
func (s *GCloudStorageImpl) DeleteTag(bundleMeta *BundleMeta, tag string) error
DeleteTag a tag for the bundleId and tag. If the tag does not exist, and error will be reteurned
func (*GCloudStorageImpl) GetBundle ¶
func (s *GCloudStorageImpl) GetBundle(bundleMeta *BundleMeta, sha512 string) (io.ReadCloser, error)
GetBundle the bundle and return it
func (*GCloudStorageImpl) GetBundleOwner ¶
func (s *GCloudStorageImpl) GetBundleOwner(bundleID string) (*BundleMeta, error)
GetBundleOwner get a bundle's owner
func (*GCloudStorageImpl) GetRevisionForTag ¶
func (s *GCloudStorageImpl) GetRevisionForTag(bundleMeta *BundleMeta, tag string) (string, error)
GetRevisionForTag Get the revision of the bundle and tag. If none is specified an error will be returned
func (*GCloudStorageImpl) GetRevisions ¶
func (s *GCloudStorageImpl) GetRevisions(bundleMeta *BundleMeta, cursor string, pageSize int) ([]*Revision, string, error)
GetRevisions get the revisions for the bundle and return them.
func (*GCloudStorageImpl) GetTags ¶
func (s *GCloudStorageImpl) GetTags(bundleMeta *BundleMeta, cursor string, pageSize int) ([]*Tag, string, error)
GetTags get the tags
func (*GCloudStorageImpl) SaveBundle ¶
func (s *GCloudStorageImpl) SaveBundle(bytes io.Reader, bundleMeta *BundleMeta) (string, error)
SaveBundle store the bytes of the bundle id
type Revision ¶
type Revision struct { //The bundle name BundleID string //The SHa512 revision of the bundle RevisionSha512 string //the timestamp the bundle was created Created time.Time }
Revision when a revision is created
type Storage ¶
type Storage interface { //SaveBundle store the bytes of the bundle id. Returns the new revision and any error SaveBundle(bytes io.Reader, owner *BundleMeta) (string, error) //GetBundle get the bundle and return it GetBundle(bundleMeta *BundleMeta, revision string) (io.ReadCloser, error) //GetRevisions get the revisions for the bundle and return them. GetRevisions(bundleMeta *BundleMeta, cursor string, pageSize int) ([]*Revision, string, error) //CreateTag create a tag for the bundle id. Will return ErrRevisionNotExist if the revision does not exist CreateTag(bundleMeta *BundleMeta, revision, tag string) error //GetTags get the tags for the bundle. TODO, maybe make this an iterator for the return? GetTags(bundleMeta *BundleMeta, cursor string, pageSize int) ([]*Tag, string, error) //GetRevisionForTag Get the revision of the bundle and tag. If none is specified an error will be returned GetRevisionForTag(bundleMeta *BundleMeta, tag string) (string, error) //DeleteTag a tag for the bundleId and tag. If the tag does not exist, a ErrTagNotExist will be reteurned DeleteTag(bundleMeta *BundleMeta, tag string) error }
Storage the interface for bundle storage
func CreateGCloudStorage ¶
CreateGCloudStorage create the s3 storage provider and return it. The serviceAccountFile can be empty, in which case defaults are used. see https://cloud.google.com/vision/docs/common/auth for setting creds