shock

package
v0.9.68 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2018 License: BSD-2-Clause Imports: 15 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DATA_SUFFIX = "?download"
View Source
var SHOCK_TIMEOUT = 60 * time.Second
View Source
var WAIT_SLEEP = 30 * time.Second
View Source
var WAIT_TIMEOUT = time.Duration(-1) * time.Hour

Functions

func CopyFile

func CopyFile(src, dst string) (size int64, err error)

source: http://stackoverflow.com/a/22259280 TODO this is not shock related, need another package

func FetchFile

func FetchFile(filename string, url string, token string, uncompress string, computeMD5 bool) (size int64, md5sum string, err error)

fetch file by shock url

func FetchShockStream

func FetchShockStream(url string, token string) (r io.ReadCloser, err error)

func ShockDelete

func ShockDelete(host string, nodeid string, token string) (err error)

Types

type IdxInfo

type IdxInfo struct {
	//Type      string `bson:"index_type" json:"-"`
	TotalUnits  int64 `bson:"total_units" json:"total_units" mapstructure:"total_units"`
	AvgUnitSize int64 `bson:"average_unit_size" json:"average_unit_size" mapstructure:"average_unit_size"`
	//Format  string    `bson:"format" json:"-"`
	CreatedOn time.Time `bson:"created_on" json:"created_on" mapstructure:"created_on"`
	Locked    *lockInfo `bson:"-" json:"locked"`
}

type Opts added in v0.9.62

type Opts map[string]string

func (*Opts) HasKey added in v0.9.62

func (o *Opts) HasKey(key string) bool

func (*Opts) Value added in v0.9.62

func (o *Opts) Value(key string) string

type ShockClient

type ShockClient struct {
	Host  string
	Token string
	Debug bool
}

func (*ShockClient) CreateOrUpdate added in v0.9.62

func (sc *ShockClient) CreateOrUpdate(opts Opts, nodeid string, nodeattr map[string]interface{}) (node *ShockNode, err error)

func (*ShockClient) Do_request added in v0.9.13

func (sc *ShockClient) Do_request(method string, resource string, query url.Values, header *httpclient.Header, response interface{}) (err error)

func (*ShockClient) Get_node added in v0.9.13

func (sc *ShockClient) Get_node(node_id string) (node *ShockNode, err error)

func (*ShockClient) Get_node_download_url

func (sc *ShockClient) Get_node_download_url(node ShockNode) (download_url string, err error)

func (*ShockClient) Get_request

func (sc *ShockClient) Get_request(resource string, query url.Values, response interface{}) (err error)

func (*ShockClient) Make_public added in v0.9.13

func (sc *ShockClient) Make_public(node_id string) (sqr_p *ShockResponseGeneric, err error)

func (*ShockClient) PostNodeWithToken added in v0.9.62

func (sc *ShockClient) PostNodeWithToken(filename string, numParts int) (nodeid string, err error)

func (*ShockClient) Post_request added in v0.9.62

func (sc *ShockClient) Post_request(resource string, query url.Values, header *httpclient.Header, response interface{}) (err error)

func (*ShockClient) PutFileToShock added in v0.9.62

func (sc *ShockClient) PutFileToShock(filename string, nodeid string, rank int, attrfile string, ntype string, formopts map[string]string, nodeattr map[string]interface{}) (new_node_id string, err error)

should return node id if you create new node (i.e. do not specify node id)

func (*ShockClient) Put_request added in v0.9.13

func (sc *ShockClient) Put_request(resource string, query url.Values, response interface{}) (err error)

func (*ShockClient) Query

func (sc *ShockClient) Query(query url.Values) (sqr_p *ShockQueryResponse, err error)

example: query_response_p, err := sc.Shock_query(host, url.Values{"docker": {"1"}, "docker_image_name" : {"wgerlach/bowtie2:2.2.0"}});

func (*ShockClient) ShockPutIndex added in v0.9.62

func (sc *ShockClient) ShockPutIndex(nodeid string, indexname string) (err error)

func (*ShockClient) WaitFile added in v0.9.68

func (sc *ShockClient) WaitFile(nodeid string) (node *ShockNode, err error)

func (*ShockClient) WaitIndex added in v0.9.68

func (sc *ShockClient) WaitIndex(nodeid string, indexname string) (index IdxInfo, err error)

type ShockNode

type ShockNode struct {
	Id         string             `bson:"id" json:"id"`
	Version    string             `bson:"version" json:"version"`
	File       shockFile          `bson:"file" json:"file"`
	Attributes interface{}        `bson:"attributes" json:"attributes"`
	Indexes    map[string]IdxInfo `bson:"indexes" json:"indexes"`
	//Acl      Acl                 `bson:"acl" json:"-"`
	VersionParts map[string]string `bson:"version_parts" json:"version_parts"`
	Tags         []string          `bson:"tags" json:"tags"`
	//Revisions  []ShockNode       `bson:"revisions" json:"-"`
	Linkages     []linkage `bson:"linkage" json:"linkage"`
	Priority     int       `bson:"priority" json:"priority"`
	CreatedOn    time.Time `bson:"created_on" json:"created_on"`
	LastModified time.Time `bson:"last_modified" json:"last_modified"`
	Expiration   time.Time `bson:"expiration" json:"expiration"`
	Type         string    `bson:"type" json:"type"`
	//Subset     Subset    `bson:"subset" json:"-"`
	Parts *partsList `bson:"parts" json:"parts"`
}

func ShockGet

func ShockGet(host string, nodeid string, token string) (node *ShockNode, err error)

type ShockQueryResponse

type ShockQueryResponse struct {
	Code       int         `bson:"status" json:"status"`
	Data       []ShockNode `bson:"data" json:"data"`
	Errs       []string    `bson:"error" json:"error"`
	Limit      int         `bson:"limit" json:"limit"`
	Offset     int         `bson:"offset" json:"offset"`
	TotalCount int         `bson:"total_count" json:"total_count"`
}

type ShockResponse

type ShockResponse struct {
	Code int       `bson:"status" json:"status"`
	Data ShockNode `bson:"data" json:"data"`
	Errs []string  `bson:"error" json:"error"`
}

type ShockResponseGeneric added in v0.9.13

type ShockResponseGeneric struct {
	Code int         `bson:"status" json:"status"`
	Data interface{} `bson:"data" json:"data"`
	Errs []string    `bson:"error" json:"error"`
}

Jump to

Keyboard shortcuts

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