Versions in this module Expand all Collapse all v0 v0.1.0 Dec 19, 2022 Changes in this version + const CursorKey + const Delim + const ExpiresAtKey + const ExpiresInKey + const Flush + const HashAlgoKey + const LimitKey + const PathKey + const RefnameKey + const SizeKey + const StatusAccepted + const StatusBadRequest + const StatusConflict + const StatusContinue + const StatusCreated + const StatusForbidden + const StatusInternalServerError + const StatusNotFound + const StatusOK + const TransferKey + var Debug = false + var ErrConflict = errors.New("conflict") + var ErrCorruptData = errors.New("corrupt data") + var ErrExtraData = errors.New("extra data") + var ErrInvalidOid = errors.New("invalid oid") + var ErrInvalidPacket = errors.New("invalid packet") + var ErrMissingData = errors.New("missing data") + var ErrNotAllowed = errors.New("not allowed") + var ErrParseError = errors.New("parse error") + func ArgsToList(args map[string]string) []string + func Log(v ...interface{}) + func Logf(format string, v ...interface{}) + func ParseArgs(lines []string) (map[string]string, error) + func StatusText(code uint32) string + type Backend interface + Batch func(op Operation, oids []OidWithSize) ([]BatchItem, error) + Download func(oid Oid, args ...string) (fs.File, error) + FinishUpload func(state interface{}, args ...string) error + LockBackend func() LockBackend + StartUpload func(oid Oid, r io.Reader, args ...string) (interface{}, error) + Verify func(oid Oid, args map[string]string) (Status, error) + type BatchItem struct + Oid Oid + Present bool + Size int64 + type HashingReader struct + func NewHashingReader(r io.Reader, hash hash.Hash) *HashingReader + func (h *HashingReader) Oid() (Oid, error) + func (h *HashingReader) Read(p []byte) (int, error) + func (h *HashingReader) Size() int64 + type Lock interface + AsArguments func() []string + AsLockSpec func(ownerID bool) ([]string, error) + FormattedTimestamp func() string + ID func() string + OwnerName func() string + Path func() string + Unlock func() error + type LockBackend interface + Create func(path string) (Lock, error) + FromID func(id string) (Lock, error) + FromPath func(path string) (Lock, error) + Range func(func(Lock) error) error + Unlock func(lock Lock) error + type Oid string + func NewOid(b string) (Oid, error) + func (o Oid) ExpectedPath(path string) string + func (o Oid) Stat(path string) (fs.FileInfo, error) + func (o Oid) String() string + func (o Oid) Valid() bool + func (o Oid) Value() []byte + type OidWithSize struct + Oid Oid + Size int64 + type Operation int + const DownloadOperation + const UploadOperation + func (o Operation) String() string + type Pktline struct + func NewPktline(r io.Reader, w io.Writer) *Pktline + func (p *Pktline) ReadPacketListToDelim() ([]string, error) + func (p *Pktline) ReadPacketListToFlush() ([]string, error) + func (p *Pktline) Reader() *pktline.PktlineReader + func (p *Pktline) ReaderWithSize(size int) *pktline.PktlineReader + func (p *Pktline) SendError(status uint32, message string) error + func (p *Pktline) SendStatus(status Status) error + func (p *Pktline) Writer() *pktline.PktlineWriter + func (p *Pktline) WriterWithSize(size int) *pktline.PktlineWriter + type Processor struct + func NewProcessor(line *Pktline, backend Backend) *Processor + func (Processor) SizeFromArgs(args map[string]string) (int64, error) + func (p *Processor) BatchData(op Operation, presentAction string, missingAction string) (Status, error) + func (p *Processor) DownloadBatch() (Status, error) + func (p *Processor) Error(code uint32, message string) (Status, error) + func (p *Processor) GetObject(oid Oid) (Status, error) + func (p *Processor) ListLocks(useOwnerID bool) (Status, error) + func (p *Processor) ListLocksForPath(path string, cursor string, useOwnerID bool) (Status, error) + func (p *Processor) Lock() (Status, error) + func (p *Processor) ProcessCommands(op Operation) error + func (p *Processor) PutObject(oid Oid) (Status, error) + func (p *Processor) ReadBatch(op Operation) ([]BatchItem, error) + func (p *Processor) Unlock(id string) (Status, error) + func (p *Processor) UploadBatch() (Status, error) + func (p *Processor) VerifyObject(oid Oid) (Status, error) + func (p *Processor) Version() (Status, error) + type Status interface + Args func() []string + Code func() uint32 + Messages func() []string + Reader func() io.Reader + func NewFailureStatus(code uint32, message string) Status + func NewFailureStatusWithArgs(code uint32, message string, args ...string) Status + func NewSuccessStatus(messages []string) Status + func NewSuccessStatusWithCode(code uint32, args ...string) Status + func NewSuccessStatusWithData(code uint32, messages []string, args ...string) Status + func NewSuccessStatusWithReader(reader io.Reader, args ...string) Status + func SuccessStatus() Status