pyre

package
v0.0.0-...-752bf15 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package pyre provides a gRPC-based implementation of B2, as well as a RESTful gateway on top of it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterDownloadManagerOnMux

func RegisterDownloadManagerOnMux(d DownloadManager, mux *http.ServeMux)

func RegisterLargeFileManagerOnMux

func RegisterLargeFileManagerOnMux(f LargeFileManager, mux *http.ServeMux)

func RegisterServerOnMux

func RegisterServerOnMux(ctx context.Context, srv *Server, mux *http.ServeMux) error

func RegisterSimpleFileManagerOnMux

func RegisterSimpleFileManagerOnMux(f SimpleFileManager, mux *http.ServeMux)

Types

type AccountManager

type AccountManager interface {
	Authorize(acct, key string) (string, error)
	CheckCreds(token, api string) error
	APIRoot(acct string) string
	DownloadRoot(acct string) string
	UploadPartHost(fileID string) (string, error)
	UploadHost(id string) (string, error)
	Sizes(acct string) (recommended, minimum int32)
}

type BucketManager

type BucketManager interface {
	AddBucket(id, name string, bs []byte) error
	RemoveBucket(id string) error
	UpdateBucket(id string, rev int, bs []byte) error
	ListBuckets(acct string) ([][]byte, error)
	GetBucket(id string) ([]byte, error)
}

type DownloadManager

type DownloadManager interface {
	ObjectByName(bucketID, name string) (DownloadableObject, error)
	GetBucketID(bucket string) (string, error)
	GetBucket(id string) ([]byte, error)
}

type DownloadableObject

type DownloadableObject interface {
	Size() int64
	Reader() io.ReaderAt
	io.Closer
}

type LargeFileManager

type LargeFileManager interface {
	PartWriter(id string, part int) (io.WriteCloser, error)
}

type LargeFileOrganizer

type LargeFileOrganizer interface {
	Start(bucketID, fileName, fileID string, bs []byte) error
	Get(fileID string) ([]byte, error)
	Parts(fileID string) ([]string, error)
	Finish(fileID string) error
}

type ListManager

type ListManager interface {
	// NextN returns the next n objects, sorted by lexicographical order by name,
	// beginning at and including, if it exists, fileName.  If withPrefix is not
	// empty, it only returns names that begin with that prefix.  If skipPrefix
	// is not empty, then the no files with that prefix are returned.  If the two
	// conflict, skipPrefix wins (i.e., do not return the entry).
	//
	// If fewer than n entries are returned, this signifies that no more names
	// exist that meet these criteria.
	NextN(bucketID, fileName, withPrefix, skipPrefix string, n int) ([]VersionedObject, error)
}

type Server

type Server struct {
	Account   AccountManager
	Bucket    BucketManager
	LargeFile LargeFileOrganizer
	List      ListManager
}

func (*Server) AuthorizeAccount

func (s *Server) AuthorizeAccount(ctx context.Context, req *pb.AuthorizeAccountRequest) (*pb.AuthorizeAccountResponse, error)

func (*Server) CreateBucket

func (s *Server) CreateBucket(ctx context.Context, req *pb.Bucket) (*pb.Bucket, error)

func (*Server) DeleteBucket

func (s *Server) DeleteBucket(ctx context.Context, req *pb.Bucket) (*pb.Bucket, error)

func (*Server) FinishLargeFile

func (s *Server) FinishLargeFile(ctx context.Context, req *pb.FinishLargeFileRequest) (*pb.FinishLargeFileResponse, error)

func (*Server) GetUploadPartUrl

func (s *Server) GetUploadPartUrl(ctx context.Context, req *pb.GetUploadPartUrlRequest) (*pb.GetUploadPartUrlResponse, error)

func (*Server) GetUploadUrl

func (s *Server) GetUploadUrl(ctx context.Context, req *pb.GetUploadUrlRequest) (*pb.GetUploadUrlResponse, error)

func (*Server) ListBuckets

func (s *Server) ListBuckets(ctx context.Context, req *pb.ListBucketsRequest) (*pb.ListBucketsResponse, error)

func (*Server) ListFileVersions

func (s *Server) ListFileVersions(ctx context.Context, req *pb.ListFileVersionsRequest) (*pb.ListFileVersionsResponse, error)

func (*Server) StartLargeFile

func (s *Server) StartLargeFile(ctx context.Context, req *pb.StartLargeFileRequest) (*pb.StartLargeFileResponse, error)

type SimpleFileManager

type SimpleFileManager interface {
	Writer(bucket, name, id string) (io.WriteCloser, error)
}

type VersionedObject

type VersionedObject interface {
	Name() string
	NextNVersions(begin string, n int) ([]string, error)
}

Directories

Path Synopsis
Package pyre_proto is a reverse proxy.
Package pyre_proto is a reverse proxy.

Jump to

Keyboard shortcuts

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