objectstore

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2017 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteArtifact

func DeleteArtifact(art sdk.Artifact) error

DeleteArtifact an artifact with default objectstore driver

func DeletePlugin

func DeletePlugin(art sdk.ActionPlugin) error

DeletePlugin call Delete on the common driver

func DeleteTemplateExtension

func DeleteTemplateExtension(tmpl sdk.TemplateExtension) error

DeleteTemplateExtension call Delete on the common driver

func FetchArtifact

func FetchArtifact(art sdk.Artifact) (io.ReadCloser, error)

FetchArtifact an artifact with default objectstore driver

func FetchPlugin

func FetchPlugin(art sdk.ActionPlugin) (io.ReadCloser, error)

FetchPlugin call Fetch on the common driver

func FetchTemplateExtension

func FetchTemplateExtension(tmpl sdk.TemplateExtension) (io.ReadCloser, error)

FetchTemplateExtension call Fetch on the common driver

func Initialize

func Initialize(cfg Config) error

Initialize setup wanted ObjectStore driver

func Status

func Status() string

Status is for status handler

func StoreArtifact

func StoreArtifact(art sdk.Artifact, data io.ReadCloser) (string, error)

StoreArtifact an artifact with default objectstore driver

func StorePlugin

func StorePlugin(art sdk.ActionPlugin, data io.ReadCloser) (string, error)

StorePlugin call Store on the common driver

func StoreTemplateExtension

func StoreTemplateExtension(tmpl sdk.TemplateExtension, data io.ReadCloser) (string, error)

StoreTemplateExtension call Store on the common driver

func StreamFile

func StreamFile(w io.Writer, f io.ReadCloser) error

StreamFile streams file

Types

type AccessType

type AccessType struct {
	Token          Token                 `json:"token"`
	User           interface{}           `json:"id"`
	ServiceCatalog []ServiceCatalogEntry `json:"servicecatalog"`
}

AccessType describe the access given by token

type AuthToken

type AuthToken struct {
	Access AccessType `json:"access"`
}

AuthToken is a specific openstack format

type Config added in v0.4.0

type Config struct {
	Kind    Kind
	Options ConfigOptions
}

Config represents all the configuration for all objecstore drivers

type ConfigOptions added in v0.4.0

type ConfigOptions struct {
	Openstack  ConfigOptionsOpenstack
	Filesystem ConfigOptionsFilesystem
}

ConfigOptions is used by Config

type ConfigOptionsFilesystem added in v0.4.0

type ConfigOptionsFilesystem struct {
	Basedir string
}

ConfigOptionsFilesystem is used by ConfigOptions

type ConfigOptionsOpenstack added in v0.4.0

type ConfigOptionsOpenstack struct {
	Address  string
	Username string
	Password string
	Tenant   string
	Region   string
}

ConfigOptionsOpenstack is used by ConfigOptions

type Driver

type Driver interface {
	Status() string
	Store(o Object, data io.ReadCloser) (string, error)
	Fetch(o Object) (io.ReadCloser, error)
	Delete(o Object) error
}

Driver allows artifact to be stored and retrieve the same way to any backend - Openstack / Swift - Filesystem

func New

func New(cfg Config) (Driver, error)

New initialise a new ArtifactStorage

type FilesystemStore

type FilesystemStore struct {
	// contains filtered or unexported fields
}

FilesystemStore implements ObjectStore interface with filesystem driver

func NewFilesystemStore

func NewFilesystemStore(basedir string) (*FilesystemStore, error)

NewFilesystemStore creates a new ObjectStore with filesystem driver

func (*FilesystemStore) Delete

func (fss *FilesystemStore) Delete(o Object) error

Delete data on disk

func (*FilesystemStore) Fetch

func (fss *FilesystemStore) Fetch(o Object) (io.ReadCloser, error)

Fetch lookup on disk for data

func (*FilesystemStore) Status

func (fss *FilesystemStore) Status() string

Status return filesystem storage status

func (*FilesystemStore) Store

func (fss *FilesystemStore) Store(o Object, data io.ReadCloser) (string, error)

Store store a object on disk

type Kind added in v0.4.0

type Kind int

Kind will define const defining all supported objecstore drivers

const (
	Openstack Kind = iota
	Filesystem
	Swift
)

These are the defined objecstore drivers

type Object

type Object interface {
	GetName() string
	GetPath() string
}

Object is the interface for stuff needed to be stored in object store

type OpenstackStore

type OpenstackStore struct {
	// contains filtered or unexported fields
}

OpenstackStore implements ObjectStore interface with openstack implementation

func NewOpenstackStore

func NewOpenstackStore(address, user, password, tenant, region string) (*OpenstackStore, error)

NewOpenstackStore create a new ObjectStore with openstack driver and check configuration

func (*OpenstackStore) Delete

func (ops *OpenstackStore) Delete(o Object) error

Delete should delete on openstack

func (*OpenstackStore) Fetch

func (ops *OpenstackStore) Fetch(o Object) (io.ReadCloser, error)

Fetch lookup on openstack to fetch data

func (*OpenstackStore) Status

func (ops *OpenstackStore) Status() string

Status return Openstack storage status

func (*OpenstackStore) Store

func (ops *OpenstackStore) Store(o Object, data io.ReadCloser) (string, error)

Store stores in openstack

type ServiceCatalogEntry

type ServiceCatalogEntry struct {
	Name      string            `json:"name"`
	Type      string            `json:"type"`
	Endpoints []ServiceEndpoint `json:"endpoints"`
}

ServiceCatalogEntry is an openstack specific object

type ServiceEndpoint

type ServiceEndpoint struct {
	Type        string `json:"type"`
	Region      string `json:"region"`
	PublicURL   string `json:"publicurl"`
	AdminURL    string `json:"adminurl"`
	InternalURL string `json:"internalurl"`
	VersionID   string `json:"versionid"`
}

ServiceEndpoint describe an openstack endpoint

type Token

type Token struct {
	ID      string    `json:"id"`
	Expires time.Time `json:"expires"`
	Project struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"tenant"`
}

Token represent an openstack token

Jump to

Keyboard shortcuts

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