Documentation
¶
Index ¶
- Constants
- func CreateInstance(ctx context.Context, name string, metadata []*MetadataItem, disksize int64) (err error)
- func DeleteInstance(ctx context.Context, name string) (err error)
- type CloudStorageService
- func (s *CloudStorageService) CreateIfNotExists() (err error)
- func (s *CloudStorageService) Delete(name string) (err error)
- func (s *CloudStorageService) Download(filename string, out io.Writer) (err error)
- func (s *CloudStorageService) List(prefix string, handler FileInfoHandler) error
- func (s *CloudStorageService) Status(filename string) (info *FileInfo, err error)
- func (s *CloudStorageService) Upload(in io.Reader, location *url.URL) (err error)
- type Datastore
- func (d *Datastore) FindTasks(name string, handler func(*resource.Task) error) (err error)
- func (d *Datastore) Insert(id int64, task *resource.Task) (err error)
- func (d *Datastore) QueueNames(handler func(string) error) (err error)
- func (d *Datastore) UpdateTasks(name string, handler func(*resource.Task) (*resource.Task, error)) (err error)
- type FileInfo
- type FileInfoHandler
- type MachineType
- type MetadataItem
- type QueueName
- type Storage
- func (s *Storage) DeleteFiles(prefix string, queries []string) error
- func (s *Storage) DownloadFiles(prefix, dir string, queries []string) (err error)
- func (s *Storage) ListupFiles(prefix string, handler FileInfoHandler) (err error)
- func (s *Storage) PrepareBucket() error
- func (s *Storage) PrintFileBody(prefix, query string, output io.Writer, header bool) error
- func (s *Storage) UploadFile(prefix, name, input string) (string, error)
- type Zone
Constants ¶
const QueueKind = "roadie-queue"
QueueKind defines kind of entries stored in cloud datastore.
Variables ¶
This section is empty.
Functions ¶
func CreateInstance ¶
func CreateInstance(ctx context.Context, name string, metadata []*MetadataItem, disksize int64) (err error)
CreateInstance creates a new instance based on the bilder's configuration.
Types ¶
type CloudStorageService ¶
type CloudStorageService struct {
// contains filtered or unexported fields
}
CloudStorageService object.
func NewCloudStorageService ¶
func NewCloudStorageService(ctx context.Context) *CloudStorageService
NewCloudStorageService creates a new storage accessor to a bucket name under the given contest. The context must have a config.
func (*CloudStorageService) CreateIfNotExists ¶
func (s *CloudStorageService) CreateIfNotExists() (err error)
CreateIfNotExists creates the bucket if not exists.
func (*CloudStorageService) Delete ¶
func (s *CloudStorageService) Delete(name string) (err error)
Delete deletes a given file.
func (*CloudStorageService) Download ¶
func (s *CloudStorageService) Download(filename string, out io.Writer) (err error)
Download downloads a file and write it to a given writer.
func (*CloudStorageService) List ¶
func (s *CloudStorageService) List(prefix string, handler FileInfoHandler) error
List searches items, i.e. files and folders, matching a given prefix. Found items will be passed to a given handler item by item. If the handler returns a non nil value, listing up will be canceled. In that case, this function will also return the given value.
type Datastore ¶ added in v0.3.0
type Datastore struct {
// contains filtered or unexported fields
}
func NewDatastore ¶ added in v0.3.0
NewDatastore creates a new datastore interface, It requires a context which has a config object.
func (*Datastore) FindTasks ¶ added in v0.3.0
FindTasks lists up tasks in a given named queue. Founded tasks will be passed to a given handler function. If the hunder function returns non-nil error, the listing up will be stopped.
func (*Datastore) QueueNames ¶ added in v0.3.0
QueueNames lists up queue names. Founded names are passed to a given handler function. If the handler returns non-nil error, listing up will be stopped.
func (*Datastore) UpdateTasks ¶ added in v0.3.0
func (d *Datastore) UpdateTasks(name string, handler func(*resource.Task) (*resource.Task, error)) (err error)
UpdateTasks updates tasks in a given named queue. Each task will be passed to a given handler. The handler should return modified tasks. If the handler returns non-nil error, the update will be stopped.
type FileInfo ¶
FileInfo defines file information structure.
func NewFileInfo ¶
NewFileInfo creates a file info from an object.
type FileInfoHandler ¶
FileInfoHandler is a handler to recieve a file info.
type MachineType ¶
MachineType defines a structure of machine type infoemation.
func AvailableMachineTypes ¶
func AvailableMachineTypes(ctx context.Context) (types []MachineType, err error)
AvailableMachineTypes returns a slice of machie type names.
type MetadataItem ¶
MetadataItem has Key and Value properties.
type QueueName ¶ added in v0.3.0
type QueueName struct { // Queue name. QueueName string }
QueueName is a structure to obtaine QueueName attribute from entities in cloud datastore.
type Storage ¶
type Storage struct { // Writer logs to be printed. Log io.Writer // contains filtered or unexported fields }
Storage provides APIs to access a cloud storage.
func NewStorage ¶
NewStorage creates a cloud storage accessor with a given context. The context must have a Config.
func (*Storage) DeleteFiles ¶
DeleteFiles deletes files in a bucket associated with a project, which has a prefix and satisfies a query. This request will be done under a given context.
func (*Storage) DownloadFiles ¶
DownloadFiles downloads files in a bucket associated with a project, which has a prefix and satisfies a query under a given context. Downloaded files will be put in a given directory.
func (*Storage) ListupFiles ¶
func (s *Storage) ListupFiles(prefix string, handler FileInfoHandler) (err error)
ListupFiles lists up files in a bucket associated with a project and which have a prefix under a given context. Information of found files will be passed to a handler. If the handler returns non nil value, the listing up will be canceled. In this case, this function also returns the given error value.
func (*Storage) PrepareBucket ¶
PrepareBucket makes a bucket if it doesn't exist under a given context. The given context must have a config.
func (*Storage) PrintFileBody ¶
PrintFileBody prints file bodies which has a prefix and satisfies query under a context. If header is ture, additional messages well be printed.