Documentation ¶
Index ¶
- Variables
- type Connection
- func (c *Connection) CreateTransaction(item string, cmdlist []byte) (string, error)
- func (c *Connection) Download(w io.Writer, item string, filename string) error
- func (c *Connection) ItemInfo(item string) (*jason.Object, error)
- func (c *Connection) TransactionStatus(txid string) (TransactionInfo, error)
- func (c *Connection) Upload(uploadname string, r io.ReadSeeker, info FileInfo) error
- func (c *Connection) WaitTransaction(txid string) error
- type FileInfo
- type TransactionInfo
Constants ¶
This section is empty.
Variables ¶
var ( ErrTransaction = errors.New("error processing transaction") ErrTimeout = errors.New("timeout processing transaction") )
var ( ErrNotFound = errors.New("Item Not Found in Bendo") ErrNotAuthorized = errors.New("Access Denied") ErrUnexpectedResp = errors.New("Unexpected Response Code") ErrReadFailed = errors.New("Read Failed") ErrChecksumMismatch = errors.New("Checksum mismatch") ErrServerError = errors.New("Server Error") )
Exported errors
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct { // The bendo server this connection is to HostURL string // The chunk size to use for uploading files. // If 0, defaults to 10485760 bytes = 10 MB. ChunkSize int // An API key to use when interacting with the server. Token string // contains filtered or unexported fields }
A Connection represents a connection with a Bendo Service. It can be shared between multiple goroutines.
func (*Connection) CreateTransaction ¶
func (c *Connection) CreateTransaction(item string, cmdlist []byte) (string, error)
func (*Connection) Download ¶
Download copies the given (item, filename) pair from bendo to the given io.Writer.
func (*Connection) TransactionStatus ¶
func (c *Connection) TransactionStatus(txid string) (TransactionInfo, error)
TransactionStatus returns info on the given transaction ID. If the transaction is being processed, it does not wait for the transaction to finish. The status is an integer as given by transaction.TransactionStatus.
func (*Connection) Upload ¶
func (c *Connection) Upload(uploadname string, r io.ReadSeeker, info FileInfo) error
Upload copies r to the bendo server, storing it under the name uploadname. r must support seeking since that is used to determine the length of the content and if the md5 sum is not set in info, this function will first read r to compute it and then seek back to the beginning to then copy r to the server. Upload() will resume a partial upload if only part of r is on the server.
func (*Connection) WaitTransaction ¶
func (c *Connection) WaitTransaction(txid string) error
WaitTransaction waits for the given transaction to finish. It will return an error if the transaction had an error. It will poll the server for up to 12 hours, and then return a timeout error.
type TransactionInfo ¶
type TransactionInfo struct { Status transaction.Status Errors []string }