filehandler

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: 13 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

	// BasePath is the base context path of the REST endpoint
	BasePath string
	// ChaincodeName is the name of the chaincode that stores the files
	ChaincodeName string
	// Collection is the name of the DCAS collection that stores the file
	Collection string
	// IndexNamespace is the namespace of the index Sidetree document
	IndexNamespace string
	// IndexDocID is ID of the Sidetree document that contains the index of all files stored in this path
	IndexDocID string
}

Config defines the configuration for a file handler

type File

type File struct {
	ContentType string `json:"contentType"`
	Content     []byte `json:"content"`
}

File contains the file upload request

type FileIndex

type FileIndex struct {
	BasePath string            `json:"basePath"`
	Mappings map[string]string `json:"mappings"`
}

FileIndex contains the mappings of file name to ID

type FileIndexDoc

type FileIndexDoc struct {
	ID           string    `json:"id"`
	UniqueSuffix string    `json:"didUniqueSuffix"`
	FileIndex    FileIndex `json:"fileIndex"`
}

FileIndexDoc contains a file index document

type ResolveIndex

type ResolveIndex struct {
	*dochandler.ResolveHandler
	// contains filtered or unexported fields
}

ResolveIndex is a REST handler that retrieves a file index Sidetree documents by ID

func NewResolveIndexHandler

func NewResolveIndexHandler(path string, resolver dochandler.Resolver) *ResolveIndex

NewResolveIndexHandler returns a new resolve index handler

func (*ResolveIndex) Handler

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

Handler returns the handler

func (*ResolveIndex) Method

func (h *ResolveIndex) Method() string

Method returns the HTTP method

func (*ResolveIndex) Path

func (h *ResolveIndex) Path() string

Path returns the context path

type Retrieve

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

Retrieve manages file retrievals from a DCAS store

func NewRetrieveHandler

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

NewRetrieveHandler returns a new file retrieve handler

func (*Retrieve) Handler

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

Handler returns the 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 UpdateIndex

type UpdateIndex struct {
	*resthandler.UpdateHandler
	// contains filtered or unexported fields
}

UpdateIndex is a REST handler that creates/updates file index Sidetree documents

func NewUpdateIndexHandler

func NewUpdateIndexHandler(path string, processor resthandler.Processor, pc protocol.Client) *UpdateIndex

NewUpdateIndexHandler returns a new update index handler

func (*UpdateIndex) Handler

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

Handler returns the handler

func (*UpdateIndex) Method

func (h *UpdateIndex) Method() string

Method returns the HTTP method

func (*UpdateIndex) Path

func (h *UpdateIndex) Path() string

Path returns the context path

type Upload

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

Upload manages file uploads to a DCAS store

func NewUploadHandler

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

NewUploadHandler returns a new file upload handler

func (*Upload) Handler

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

Handler returns the 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

Jump to

Keyboard shortcuts

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