dcashandler

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Authorization authhandler.Config

	// Version is the version of the DCAS endpoint
	Version string
	// BasePath is the base context path of the REST endpoint
	BasePath string
	// ChaincodeName is the name of the chaincode that stores the content
	ChaincodeName string
	// Collection is the name of the DCAS collection that stores the content
	Collection string
}

Config defines the configuration for a DCAS handler

type ResultCode

type ResultCode = string

ResultCode specifies the status string of a read result

const (
	// CodeCasNotReachable indicates that there was an error when attempting to communicate with the CAS service
	CodeCasNotReachable ResultCode = "cas_not_reachable"
	// CodeInvalidHash indicates that the hash was not specified or is invalid
	CodeInvalidHash ResultCode = "content_hash_invalid"
	// CodeMaxSizeExceeded indicates that the resulting content exceeds the maximum size specified in the request
	CodeMaxSizeExceeded ResultCode = "content_exceeds_maximum_allowed_size"
	// CodeMaxSizeNotSpecified indicates that the max-size parameter was not specified in the request
	CodeMaxSizeNotSpecified ResultCode = "content_max_size_not_specified"
	// CodeNotFound indicates that the content for the given hash was not found
	CodeNotFound ResultCode = "content_not_found"
)

type Retrieve

type Retrieve struct {
	Config
	// contains filtered or unexported fields
}

Retrieve manages file retrievals from the DCAS store

func NewRetrieveHandler

func NewRetrieveHandler(channelID string, cfg Config, dcasProvider dcasClientProvider) *Retrieve

NewRetrieveHandler returns a new Retrieve handler

func (*Retrieve) Handler

func (h *Retrieve) Handler() common.HTTPRequestHandler

Handler returns the request handler

func (*Retrieve) Method

func (h *Retrieve) Method() string

Method returns the HTTP method

func (*Retrieve) Path

func (h *Retrieve) Path() string

Path returns the context path

type Upload

type Upload struct {
	Config
	// contains filtered or unexported fields
}

Upload manages uploads to a DCAS store

func NewUploadHandler

func NewUploadHandler(channelID string, cfg Config, dcasProvider dcasClientProvider) *Upload

NewUploadHandler returns a new DCAS upload handler

func (*Upload) Handler

func (h *Upload) Handler() common.HTTPRequestHandler

Handler returns the request handler

func (*Upload) Method

func (h *Upload) Method() string

Method returns the HTTP method

func (*Upload) Path

func (h *Upload) Path() string

Path returns the context path

type UploadResponse

type UploadResponse struct {
	Hash string `json:"hash"`
}

UploadResponse contains the response from a CAS upload

type Version

type Version struct {
	*versionhandler.Version
}

Version handles version requests

func NewVersionHandler

func NewVersionHandler(channelID string, cfg Config) *Version

NewVersionHandler returns a new Version handler

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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