Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrFileNameMissing is returned when no file name was given. ErrFileNameMissing = errors.New("the first chunk should have the filename") // ErrNoSession is returned when no session id found for a given id. ErrNoSession = errors.New("no open file session with this id") // is not allowed to get ErrUnauthorized = errors.New("peer not authorized for requested file") )
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface { // BeginWrite creates an empty file. BeginWrite(ctx context.Context, fileName string) (uuid.UUID, error) // WriteChunk writes a chunk of data to a file identified by its ID. WriteChunk(ctx context.Context, sessionID uuid.UUID, chunk []byte) (err error) // EndWrite is called to finalize the file writing. EndWrite(ctx context.Context, sessionID uuid.UUID) (fileHash []byte, err error) // AbortWrite is called to abort the file writing process. AbortWrite(ctx context.Context, sessionID uuid.UUID) (err error) // ReadChunks reads a file by chunk and calls the callback for each chunk. ReadChunks(ctx context.Context, fileHash []byte, chunkSize int, reader Reader) error // Read returns the content of a file given its hash. Read(ctx context.Context, fileHash []byte) ([]byte, error) // Exists returns whether the file with the given hash exists in the handler db. Exists(ctx context.Context, fileHash []byte) (bool, error) }
Handler contains the methods to handle a file on the Stratumn node.
Directories ¶
Path | Synopsis |
---|---|
Package mockhandler is a generated GoMock package.
|
Package mockhandler is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.