Documentation ¶
Overview ¶
Package storage contains the Storage interface and its various implementations for different backends.
Index ¶
Constants ¶
const ( HeaderAcceptRanges = "Accept-Ranges" HeaderContentLength = "Content-Length" HeaderContentRange = "Content-Range" HeaderContentType = "Content-Type" HeaderETag = "ETag" HeaderLastModified = "Last-Modified" HeaderRange = "Range" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetPartiallyRequestOptions ¶ added in v0.1.0
type GetPartiallyRequestOptions struct {
Range string
}
GetPartiallyRequestOptions holds option to request data from storage
type HystrixCommand ¶
type HystrixCommand struct { Name string Config hystrix.CommandConfig }
HystrixCommand wraps the command name and the configuration to be used with hystrix
type IResponse ¶
type IResponse interface { // Data method returns a byte array if the operation was successful Data() []byte // Error method returns an error if the operation was unsuccessful Error() error // Status method returns the http StatusCode from the storage backend if there is any Status() int // Metadata method returns response metadata if the operation is successful and client support metadata Metadata() *ResponseMetadata }
IResponse interface sets the contract that can be used to return the result from different Storage backends.
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response implements the IResponse interface
func NewResponse ¶
NewResponse takes data, statusCode and error as arguments and returns a new Response
func (*Response) Metadata ¶ added in v0.1.0
func (r *Response) Metadata() *ResponseMetadata
Metadata returns metadata field from the struct
func (*Response) WithMetadata ¶ added in v0.1.0
func (r *Response) WithMetadata(metadata *ResponseMetadata) *Response
WithMetadata sets metadata field on the struct
type ResponseMetadata ¶ added in v0.1.0
type ResponseMetadata struct { AcceptRanges string ContentLength string ContentRange string ContentType string ETag string LastModified string }
ResponseMetadata contains metadata of the storage response
type Storage ¶
type Storage interface { // Get takes in the Context and path as an argument and returns an IResponse interface implementation. // This method figures out how to get the data from the storage backend. Get(ctx context.Context, path string) IResponse // GetPartially takes in the Context, path, and opt as an argument and returns an IResponse interface implementation. // This method figures out how to get partial data from the storage backend. GetPartially(ctx context.Context, path string, opt *GetPartiallyRequestOptions) IResponse }
Storage interface sets the contract that the implementation has to fulfil.