files

package
v0.0.0-...-afb99dd Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemeFS  = "files"
	SchemeRef = "ref"
)
View Source
const (
	AttrPrefix = "store-"

	AttrPermissions = AttrPrefix + "permissions"
)

Variables

This section is empty.

Functions

func ContextWithAccessManager

func ContextWithAccessManager(parent context.Context, manager AccessManager) context.Context

func ContextWithClientProvider

func ContextWithClientProvider(parent context.Context, provider ClientProvider) context.Context

func ContextWithRouterProvider

func ContextWithRouterProvider(parent context.Context, provider RouterProvider) context.Context

func ContextWithSourcesServiceClientProvider

func ContextWithSourcesServiceClientProvider(parent context.Context, provider SourcesServiceClientProvider) context.Context

func ContextWithTransfersServiceClientProvider

func ContextWithTransfersServiceClientProvider(parent context.Context, provider TransfersServiceClientProvider) context.Context

func CopyFile

func CopyFile(ctx context.Context, sourceID string, filename string, dirname string, opts CopyFileOptions) error

func CreateAccess

func CreateAccess(ctx context.Context, source *pb.FSAccess, opts CreateAccessOptions) error

func CreateDir

func CreateDir(ctx context.Context, sourceID string, dirname string, opts CreateDirOptions) error

func DeleteAccess

func DeleteAccess(ctx context.Context, sourceID string, opts DeleteAccessOptions) error

func DeleteFile

func DeleteFile(ctx context.Context, sourceID string, filename string, opts DeleteFileOptions) error

func GetAccess

func GetAccess(ctx context.Context, sourceID string, opts GetAccessOptions) (*pb.FSAccess, error)

func GetAccessList

func GetAccessList(ctx context.Context, opts GetAccessListOptions) ([]*pb.FSAccess, error)

func GetFile

func GetFile(ctx context.Context, sourceID string, filename string, opts GetFileOptions) (*pb.File, error)

func HTTPHandleCreateAccess

func HTTPHandleCreateAccess(w http.ResponseWriter, r *http.Request)

func HTTPHandleCreateFile

func HTTPHandleCreateFile(w http.ResponseWriter, r *http.Request)

func HTTPHandleDeleteAccess

func HTTPHandleDeleteAccess(w http.ResponseWriter, r *http.Request)

func HTTPHandleDeleteFile

func HTTPHandleDeleteFile(w http.ResponseWriter, r *http.Request)

func HTTPHandleDownloadFile

func HTTPHandleDownloadFile(w http.ResponseWriter, r *http.Request)

func HTTPHandleGetAccess

func HTTPHandleGetAccess(w http.ResponseWriter, r *http.Request)

func HTTPHandleGetAccessList

func HTTPHandleGetAccessList(w http.ResponseWriter, r *http.Request)

func HTTPHandleGetFileAttributes

func HTTPHandleGetFileAttributes(w http.ResponseWriter, r *http.Request)

func HTTPHandleGetFileInfo

func HTTPHandleGetFileInfo(w http.ResponseWriter, r *http.Request)

func HTTPHandleListDir

func HTTPHandleListDir(w http.ResponseWriter, r *http.Request)

func HTTPHandlePatchFileTree

func HTTPHandlePatchFileTree(w http.ResponseWriter, r *http.Request)

func HTTPHandleSetFileAttributes

func HTTPHandleSetFileAttributes(w http.ResponseWriter, r *http.Request)

func HTTPHandleUploadFile

func HTTPHandleUploadFile(w http.ResponseWriter, r *http.Request)

func LimitReadCloser

func LimitReadCloser(readCloser io.ReadCloser, n int64) io.ReadCloser

func Middleware

func Middleware(opts ...MiddlewareOption) mux.MiddlewareFunc

func MoveFile

func MoveFile(ctx context.Context, sourceID string, filename string, dirname string, opts MoveFileOptions) error

func MuxRouter

func MuxRouter(middleware ...mux.MiddlewareFunc) http.Handler

func NewAccessSQLManager

func NewAccessSQLManager(db *sql.DB, dialect string, tablePrefix string) (*accessSQLManager, error)

func NewAccessServerHandler

func NewAccessServerHandler() pb.AccessManagerServer

func NewClient

func NewClient(ctx context.Context, serviceType uint32) (pb.FilesClient, error)

NewClient is a FilesClient constructor

func NewFilesServerHandler

func NewFilesServerHandler() pb.FilesServer

func NewSourcesServiceClient

func NewSourcesServiceClient(ctx context.Context, serviceType uint32) (pb.AccessManagerClient, error)

NewSourcesServiceClient is a source service client constructor

func NormalizePath

func NormalizePath(p string) string

func ReadFileContent

func ReadFileContent(ctx context.Context, sourceID string, filename string, opts ReadOptions) (io.ReadCloser, int64, error)

func RenameFile

func RenameFile(ctx context.Context, sourceID string, filename string, newName string, opts RenameFileOptions) error

func SetFileAttributes

func SetFileAttributes(ctx context.Context, sourceID string, filename string, attrs Attributes, opts SetFileAttributesOptions) error

func Split

func Split(filename string) (string, string)

func UnNormalizePath

func UnNormalizePath(p string) string

func WriteFileContent

func WriteFileContent(ctx context.Context, sourceID string, filename string, content io.Reader, size int64, opts WriteOptions) error

Types

type ACLHandler

type ACLHandler struct {
	BaseHandler
}

func (*ACLHandler) CloseMultipartSession

func (h *ACLHandler) CloseMultipartSession(ctx context.Context, accessID string, opts CloseMultipartSessionOptions) error

func (*ACLHandler) CopyFile

func (h *ACLHandler) CopyFile(ctx context.Context, accessID string, filename string, dirname string, opts CopyFileOptions) error

func (*ACLHandler) CreateAccess

func (h *ACLHandler) CreateAccess(ctx context.Context, access *pb.FSAccess, opts CreateAccessOptions) error

func (*ACLHandler) CreateDir

func (h *ACLHandler) CreateDir(ctx context.Context, accessID string, dirname string, opts CreateDirOptions) error

func (*ACLHandler) DeleteAccess

func (h *ACLHandler) DeleteAccess(ctx context.Context, accessID string, _ DeleteAccessOptions) error

func (*ACLHandler) DeleteFile

func (h *ACLHandler) DeleteFile(ctx context.Context, accessID string, filename string, opts DeleteFileOptions) error

func (*ACLHandler) DeleteShares

func (h *ACLHandler) DeleteShares(ctx context.Context, shares []*pb.ShareInfo, _ DeleteSharesOptions) error

DeleteShares checks if the requester user is a sharer of the resource for each share info passed. Then we want to make sure the request user has the roles he wants to delete from other users

func (*ACLHandler) GetAccess

func (h *ACLHandler) GetAccess(ctx context.Context, accessID string, opts GetAccessOptions) (*pb.FSAccess, error)

func (*ACLHandler) GetAccessList

func (h *ACLHandler) GetAccessList(ctx context.Context, _ GetAccessListOptions) ([]*pb.FSAccess, error)

func (*ACLHandler) GetFileAttributes

func (h *ACLHandler) GetFileAttributes(ctx context.Context, accessID string, filename string, names []string, opts GetFileAttributesOptions) (Attributes, error)

func (*ACLHandler) GetFileInfo

func (h *ACLHandler) GetFileInfo(ctx context.Context, accessID string, filename string, opts GetFileOptions) (*pb.File, error)

func (*ACLHandler) GetShares

func (h *ACLHandler) GetShares(ctx context.Context, accessID string, _ GetSharesOptions) ([]*pb.UserRole, error)

func (*ACLHandler) ListDir

func (h *ACLHandler) ListDir(ctx context.Context, accessID string, dirname string, opts ListDirOptions) (*DirContent, error)

func (*ACLHandler) MoveFile

func (h *ACLHandler) MoveFile(ctx context.Context, accessID string, filename string, dirname string, opts MoveFileOptions) error

func (*ACLHandler) OpenMultipartSession

func (h *ACLHandler) OpenMultipartSession(ctx context.Context, accessID string, filename string, info MultipartSessionInfo, opts OpenMultipartSessionOptions) (string, error)

func (*ACLHandler) ReadFileContent

func (h *ACLHandler) ReadFileContent(ctx context.Context, accessID string, filename string, opts ReadOptions) (io.ReadCloser, int64, error)

func (*ACLHandler) RenameFile

func (h *ACLHandler) RenameFile(ctx context.Context, accessID string, filename string, newName string, opts RenameFileOptions) error

func (*ACLHandler) SetFileAttributes

func (h *ACLHandler) SetFileAttributes(ctx context.Context, accessID string, filename string, attrs Attributes, opts SetFileAttributesOptions) error

func (*ACLHandler) Share

func (h *ACLHandler) Share(ctx context.Context, shares []*pb.ShareInfo, _ ShareOptions) error

Share checks if the requester user is a sharer of the resource for each share info passed. Then we want to make sure the request user has the roles he wants to share to other users

func (*ACLHandler) WriteFileContent

func (h *ACLHandler) WriteFileContent(ctx context.Context, accessID string, filename string, content io.Reader, size int64, opts WriteOptions) error

func (*ACLHandler) WriteFilePart

func (h *ACLHandler) WriteFilePart(ctx context.Context, accessID string, content io.Reader, size int64, info ContentPartInfo, opts WriteFilePartOptions) (int64, error)

type AccessManager

type AccessManager interface {
	Save(ctx context.Context, access *pb.FSAccess) (string, error)
	Get(ctx context.Context, accessID string) (*pb.FSAccess, error)
	GetResolved(ctx context.Context, accessID string) (*pb.FSAccess, error)
	Delete(ctx context.Context, accessID string) error
}

func NewSourcesManagerServiceClient

func NewSourcesManagerServiceClient(serviceType uint32) AccessManager

type AddContentPartOptions

type AddContentPartOptions struct{}

type Attribute

type Attribute interface {
	Name() string
	Value() string
}

type Attributes

type Attributes map[string]string

func GetFileAttributes

func GetFileAttributes(ctx context.Context, sourceID string, filename string, name []string, opts GetFileAttributesOptions) (Attributes, error)

type AttributesHolder

type AttributesHolder struct {
	Attributes Attributes
	// contains filtered or unexported fields
}

func (*AttributesHolder) AddReadPermissions

func (h *AttributesHolder) AddReadPermissions(_ *pb.AccessActionRelation)

func (*AttributesHolder) GetAttributes

func (h *AttributesHolder) GetAttributes() (Attributes, error)

func (*AttributesHolder) GetPermissions

func (h *AttributesHolder) GetPermissions() (*pb.AccessActionRelation, bool, error)

func (*AttributesHolder) SetEncodedPermissions

func (h *AttributesHolder) SetEncodedPermissions(_ string) error

func (*AttributesHolder) SetPermissions

func (h *AttributesHolder) SetPermissions(_ *pb.AccessActionRelation) error

type BaseHandler

type BaseHandler struct {
	// contains filtered or unexported fields
}

func (*BaseHandler) CloseMultipartSession

func (h *BaseHandler) CloseMultipartSession(ctx context.Context, sessionId string, opts CloseMultipartSessionOptions) error

func (*BaseHandler) CopyFile

func (h *BaseHandler) CopyFile(ctx context.Context, sourceID string, filename string, dirname string, opts CopyFileOptions) error

func (*BaseHandler) CreateAccess

func (h *BaseHandler) CreateAccess(ctx context.Context, source *pb.FSAccess, opts CreateAccessOptions) error

func (*BaseHandler) CreateDir

func (h *BaseHandler) CreateDir(ctx context.Context, sourceID string, dirname string, opts CreateDirOptions) error

func (*BaseHandler) DeleteAccess

func (h *BaseHandler) DeleteAccess(ctx context.Context, sourceID string, opts DeleteAccessOptions) error

func (*BaseHandler) DeleteFile

func (h *BaseHandler) DeleteFile(ctx context.Context, sourceID string, filename string, opts DeleteFileOptions) error

func (*BaseHandler) DeleteShares

func (h *BaseHandler) DeleteShares(ctx context.Context, shares []*pb.ShareInfo, opts DeleteSharesOptions) error

func (*BaseHandler) GetAccess

func (h *BaseHandler) GetAccess(ctx context.Context, sourceID string, opts GetAccessOptions) (*pb.FSAccess, error)

func (*BaseHandler) GetAccessList

func (h *BaseHandler) GetAccessList(ctx context.Context, opts GetAccessListOptions) ([]*pb.FSAccess, error)

func (*BaseHandler) GetFileAttributes

func (h *BaseHandler) GetFileAttributes(ctx context.Context, sourceID string, filename string, names []string, opts GetFileAttributesOptions) (Attributes, error)

func (*BaseHandler) GetFileInfo

func (h *BaseHandler) GetFileInfo(ctx context.Context, sourceID string, filename string, opts GetFileOptions) (*pb.File, error)

func (*BaseHandler) GetShares

func (h *BaseHandler) GetShares(ctx context.Context, accessID string, opts GetSharesOptions) ([]*pb.UserRole, error)

func (*BaseHandler) ListDir

func (h *BaseHandler) ListDir(ctx context.Context, sourceID string, dirname string, opts ListDirOptions) (*DirContent, error)

func (*BaseHandler) MoveFile

func (h *BaseHandler) MoveFile(ctx context.Context, sourceID string, filename string, dirname string, opts MoveFileOptions) error

func (*BaseHandler) OpenMultipartSession

func (h *BaseHandler) OpenMultipartSession(ctx context.Context, sourceID string, filename string, info MultipartSessionInfo, opts OpenMultipartSessionOptions) (string, error)

func (*BaseHandler) ReadFileContent

func (h *BaseHandler) ReadFileContent(ctx context.Context, sourceID string, filename string, opts ReadOptions) (io.ReadCloser, int64, error)

func (*BaseHandler) RenameFile

func (h *BaseHandler) RenameFile(ctx context.Context, sourceID string, filename string, newName string, opts RenameFileOptions) error

func (*BaseHandler) SetFileAttributes

func (h *BaseHandler) SetFileAttributes(ctx context.Context, sourceID string, filename string, attrs Attributes, opts SetFileAttributesOptions) error

func (*BaseHandler) Share

func (h *BaseHandler) Share(ctx context.Context, shares []*pb.ShareInfo, opts ShareOptions) error

func (*BaseHandler) WriteFileContent

func (h *BaseHandler) WriteFileContent(ctx context.Context, sourceID string, filename string, content io.Reader, size int64, opts WriteOptions) error

func (*BaseHandler) WriteFilePart

func (h *BaseHandler) WriteFilePart(ctx context.Context, sessionID string, content io.Reader, size int64, info ContentPartInfo, opts WriteFilePartOptions) (int64, error)

type ClientProvider

type ClientProvider interface {
	GetClient(ctx context.Context, serviceType uint32) (pb.FilesClient, error)
}

func GetClientProvider

func GetClientProvider(ctx context.Context) ClientProvider

type CloseMultipartSessionOptions

type CloseMultipartSessionOptions struct{}

type CloseMultipartWriteSessionRequest

type CloseMultipartWriteSessionRequest struct {
	SessionId string
}

type CloseMultipartWriteSessionResponse

type CloseMultipartWriteSessionResponse struct{}

type ContentPartInfo

type ContentPartInfo struct {
	ID          string `json:"id,omitempty"`
	PartNumber  int    `json:"part_number,omitempty"`
	ContentHash string `json:"content_hash"`
}

type ContentRange

type ContentRange struct {
	Offset int64 `json:"offset,omitempty"`
	Length int64 `json:"length,omitempty"`
}

type CopyFileOptions

type CopyFileOptions struct{}

type CreateAccessOptions

type CreateAccessOptions struct{}

type CreateDirOptions

type CreateDirOptions struct{}

type CustomRouter

type CustomRouter struct {
	// contains filtered or unexported fields
}

func NewCustomRouter

func NewCustomRouter(exec Handler, opts ...HandlerOption) *CustomRouter

func (*CustomRouter) GetHandler

func (r *CustomRouter) GetHandler(opts ...RouteOption) Handler

type DefaultClientProvider

type DefaultClientProvider struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*DefaultClientProvider) GetClient

func (p *DefaultClientProvider) GetClient(ctx context.Context, serviceType uint32) (pb.FilesClient, error)

type DefaultSourcesServiceClientProvider

type DefaultSourcesServiceClientProvider struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*DefaultSourcesServiceClientProvider) GetClient

type DefaultTransfersServiceClientProvider

type DefaultTransfersServiceClientProvider struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*DefaultTransfersServiceClientProvider) GetClient

type DeleteAccessOptions

type DeleteAccessOptions struct{}

type DeleteFileOptions

type DeleteFileOptions struct {
	Recursive bool `json:"recursive,omitempty"`
}

type DeleteSharesOptions

type DeleteSharesOptions struct{}

type DirContent

type DirContent struct {
	Files  []*pb.File `json:"files,omitempty"`
	Total  int        `json:"total"`
	Offset int        `json:"offset"`
}

func ListDir

func ListDir(ctx context.Context, sourceID string, dirname string, opts ListDirOptions) (*DirContent, error)

type DiskUsage

type DiskUsage struct {
	All  uint64 `json:"all"`
	Used uint64 `json:"used"`
	Free uint64 `json:"free"`
}

type EncryptionHandler

type EncryptionHandler struct {
	BaseHandler
}

func (*EncryptionHandler) ReadFileContent

func (h *EncryptionHandler) ReadFileContent(ctx context.Context, sourceID string, filename string, opts ReadOptions) (io.ReadCloser, int64, error)

func (*EncryptionHandler) WriteFileContent

func (h *EncryptionHandler) WriteFileContent(ctx context.Context, accessID string, filename string, content io.Reader, size int64, opts WriteOptions) error

func (*EncryptionHandler) WriteFilePart

func (h *EncryptionHandler) WriteFilePart(ctx context.Context, sessionID string, content io.Reader, size int64, info ContentPartInfo, opts WriteFilePartOptions) (int64, error)

type ExecHandler

type ExecHandler struct {
	BaseHandler
}

func (*ExecHandler) CloseMultipartSession

func (h *ExecHandler) CloseMultipartSession(_ context.Context, _ string, _ CloseMultipartSessionOptions) error

func (*ExecHandler) CopyFile

func (h *ExecHandler) CopyFile(ctx context.Context, accessID string, filename string, dirname string, _ CopyFileOptions) error

func (*ExecHandler) CreateAccess

func (h *ExecHandler) CreateAccess(ctx context.Context, source *pb.FSAccess, _ CreateAccessOptions) error

func (*ExecHandler) CreateDir

func (h *ExecHandler) CreateDir(ctx context.Context, accessID string, dirname string, _ CreateDirOptions) error

func (*ExecHandler) DeleteAccess

func (h *ExecHandler) DeleteAccess(ctx context.Context, accessID string, _ DeleteAccessOptions) error

func (*ExecHandler) DeleteFile

func (h *ExecHandler) DeleteFile(ctx context.Context, accessID string, filename string, opts DeleteFileOptions) error

func (*ExecHandler) GetAccess

func (h *ExecHandler) GetAccess(ctx context.Context, accessID string, _ GetAccessOptions) (*pb.FSAccess, error)

func (*ExecHandler) GetFileAttributes

func (h *ExecHandler) GetFileAttributes(ctx context.Context, accessID string, filename string, names []string, _ GetFileAttributesOptions) (Attributes, error)

func (*ExecHandler) GetFileInfo

func (h *ExecHandler) GetFileInfo(ctx context.Context, accessID string, filename string, opts GetFileOptions) (*pb.File, error)

func (*ExecHandler) ListDir

func (h *ExecHandler) ListDir(ctx context.Context, accessID string, dirname string, opts ListDirOptions) (*DirContent, error)

func (*ExecHandler) MoveFile

func (h *ExecHandler) MoveFile(ctx context.Context, accessID string, filename string, dirname string, _ MoveFileOptions) error

func (*ExecHandler) OpenMultipartSession

func (*ExecHandler) ReadFileContent

func (h *ExecHandler) ReadFileContent(ctx context.Context, accessID string, filename string, opts ReadOptions) (io.ReadCloser, int64, error)

func (*ExecHandler) RenameFile

func (h *ExecHandler) RenameFile(ctx context.Context, accessID string, filename string, newName string, _ RenameFileOptions) error

func (*ExecHandler) SetFileAttributes

func (h *ExecHandler) SetFileAttributes(ctx context.Context, accessID string, filename string, attrs Attributes, _ SetFileAttributesOptions) error

func (*ExecHandler) WriteFileContent

func (h *ExecHandler) WriteFileContent(ctx context.Context, accessID string, filename string, content io.Reader, _ int64, opts WriteOptions) error

func (*ExecHandler) WriteFilePart

type FS

type FS interface {
	Mkdir(ctx context.Context, dirname string) error
	Ls(ctx context.Context, dirname string, offset int, count int) (*DirContent, error)
	Write(ctx context.Context, filename string, content io.Reader, append bool) error
	Read(ctx context.Context, filename string, offset int64, count int64) (io.ReadCloser, int64, error)
	Info(ctx context.Context, filename string, withAttrs bool) (*pb.File, error)
	SetAttributes(ctx context.Context, filename string, attrs Attributes) error
	GetAttributes(ctx context.Context, filename string, names ...string) (Attributes, error)
	Rename(ctx context.Context, filename string, newName string) error
	Move(ctx context.Context, filename string, dirname string) error
	Copy(ctx context.Context, filename string, dirname string) error
	DeleteFile(ctx context.Context, filename string, recursive bool) error
	GetAccess() *pb.FSAccess
}

type FSProvider

type FSProvider interface {
	GetFS(source *pb.FSAccess) (FS, error)
}

type FileLocation

type FileLocation struct {
	AccessID string `json:"access_id,omitempty"`
	Filename string `json:"filename,omitempty"`
}

type GetAccessListOptions

type GetAccessListOptions struct{}

type GetAccessOptions

type GetAccessOptions struct {
	Resolved bool `json:"resolved,omitempty"`
}

type GetFSAccessOptions

type GetFSAccessOptions struct {
	Resolved bool `json:"resolved,omitempty"`
}

type GetFileAttributesOptions

type GetFileAttributesOptions struct{}

type GetFileOptions

type GetFileOptions struct {
	WithAttrs bool `json:"with_attrs,omitempty"`
}

type GetSharesOptions

type GetSharesOptions struct{}

type Handler

type Handler interface {
	CreateAccess(ctx context.Context, access *pb.FSAccess, opts CreateAccessOptions) error
	GetAccessList(ctx context.Context, opts GetAccessListOptions) ([]*pb.FSAccess, error)
	GetAccess(ctx context.Context, accessID string, opts GetAccessOptions) (*pb.FSAccess, error)
	DeleteAccess(ctx context.Context, accessID string, opts DeleteAccessOptions) error
	CreateDir(ctx context.Context, accessID string, dirname string, opts CreateDirOptions) error
	ListDir(ctx context.Context, accessID string, dirname string, opts ListDirOptions) (*DirContent, error)
	WriteFileContent(ctx context.Context, accessID string, filename string, content io.Reader, size int64, opts WriteOptions) error
	ReadFileContent(ctx context.Context, accessID string, filename string, opts ReadOptions) (io.ReadCloser, int64, error)
	Share(ctx context.Context, shares []*pb.ShareInfo, opts ShareOptions) error
	GetShares(ctx context.Context, accessID string, opts GetSharesOptions) ([]*pb.UserRole, error)
	DeleteShares(ctx context.Context, shares []*pb.ShareInfo, opts DeleteSharesOptions) error
	GetFileInfo(ctx context.Context, accessID string, filename string, opts GetFileOptions) (*pb.File, error)
	DeleteFile(ctx context.Context, accessID string, filename string, opts DeleteFileOptions) error
	SetFileAttributes(ctx context.Context, accessID string, filename string, attrs Attributes, opts SetFileAttributesOptions) error
	GetFileAttributes(ctx context.Context, accessID string, filename string, names []string, opts GetFileAttributesOptions) (Attributes, error)
	RenameFile(ctx context.Context, accessID string, filename string, newName string, opts RenameFileOptions) error
	MoveFile(ctx context.Context, accessID string, filename string, dirname string, opts MoveFileOptions) error
	CopyFile(ctx context.Context, accessID string, filename string, dirname string, opts CopyFileOptions) error
	OpenMultipartSession(ctx context.Context, accessID string, filename string, info MultipartSessionInfo, opts OpenMultipartSessionOptions) (string, error)
	WriteFilePart(ctx context.Context, accessID string, content io.Reader, size int64, info ContentPartInfo, opts WriteFilePartOptions) (int64, error)
	CloseMultipartSession(ctx context.Context, sessionID string, opts CloseMultipartSessionOptions) error
}

func GetRouteHandler

func GetRouteHandler(ctx context.Context, opt ...RouteOption) Handler

func NewHandlerServiceClient

func NewHandlerServiceClient(clientType uint32) Handler

type HandlerOption

type HandlerOption func(*objectsHandlersOptions)

func WithDefaultParamsHandler

func WithDefaultParamsHandler() HandlerOption

func WithDefaultPolicyHandler

func WithDefaultPolicyHandler() HandlerOption

type ListDirOptions

type ListDirOptions struct {
	Offset int `json:"offset"`
	Count  int `json:"count"`
}

type MiddlewareOption

type MiddlewareOption func(options *middlewareRouteOptions)

func MiddlewareWithRouterProvider

func MiddlewareWithRouterProvider(provider RouterProvider) MiddlewareOption

func MiddlewareWithSourceManager

func MiddlewareWithSourceManager(manager AccessManager) MiddlewareOption

type MoveFileOptions

type MoveFileOptions struct{}

type MultipartSessionInfo

type MultipartSessionInfo struct{}

type OpenMultipartSessionOptions

type OpenMultipartSessionOptions struct{}

type OpenMultipartSessionRequest

type OpenMultipartSessionRequest struct {
	AccessID string
	Path     string
}

type OpenMultipartSessionResponse

type OpenMultipartSessionResponse struct {
	SessionId string
}

type ParamsHandler

type ParamsHandler struct {
	BaseHandler
}

func (*ParamsHandler) CloseMultipartSession

func (h *ParamsHandler) CloseMultipartSession(ctx context.Context, sessionID string, opts CloseMultipartSessionOptions) error

func (*ParamsHandler) CopyFile

func (h *ParamsHandler) CopyFile(ctx context.Context, sourceID string, filename string, dirname string, opts CopyFileOptions) error

func (*ParamsHandler) CreateAccess

func (h *ParamsHandler) CreateAccess(ctx context.Context, source *pb.FSAccess, opts CreateAccessOptions) error

func (*ParamsHandler) CreateDir

func (h *ParamsHandler) CreateDir(ctx context.Context, sourceID string, dirname string, opts CreateDirOptions) error

func (*ParamsHandler) DeleteAccess

func (h *ParamsHandler) DeleteAccess(ctx context.Context, sourceID string, opts DeleteAccessOptions) error

func (*ParamsHandler) DeleteFile

func (h *ParamsHandler) DeleteFile(ctx context.Context, sourceID string, filename string, opts DeleteFileOptions) error

func (*ParamsHandler) GetAccess

func (h *ParamsHandler) GetAccess(ctx context.Context, sourceID string, opts GetAccessOptions) (*pb.FSAccess, error)

func (*ParamsHandler) GetFileAttributes

func (h *ParamsHandler) GetFileAttributes(ctx context.Context, sourceID string, filename string, names []string, opts GetFileAttributesOptions) (Attributes, error)

func (*ParamsHandler) GetFileInfo

func (h *ParamsHandler) GetFileInfo(ctx context.Context, sourceID string, filename string, opts GetFileOptions) (*pb.File, error)

func (*ParamsHandler) ListDir

func (h *ParamsHandler) ListDir(ctx context.Context, sourceID string, dirname string, opts ListDirOptions) (*DirContent, error)

func (*ParamsHandler) MoveFile

func (h *ParamsHandler) MoveFile(ctx context.Context, sourceID string, filename string, dirname string, opts MoveFileOptions) error

func (*ParamsHandler) OpenMultipartSession

func (h *ParamsHandler) OpenMultipartSession(ctx context.Context, sourceID string, filename string, info MultipartSessionInfo, opts OpenMultipartSessionOptions) (string, error)

func (*ParamsHandler) ReadFileContent

func (h *ParamsHandler) ReadFileContent(ctx context.Context, sourceID string, filename string, opts ReadOptions) (io.ReadCloser, int64, error)

func (*ParamsHandler) RenameFile

func (h *ParamsHandler) RenameFile(ctx context.Context, sourceID string, filename string, newName string, opts RenameFileOptions) error

func (*ParamsHandler) SetFileAttributes

func (h *ParamsHandler) SetFileAttributes(ctx context.Context, sourceID string, filename string, attrs Attributes, opts SetFileAttributesOptions) error

func (*ParamsHandler) WriteFileContent

func (h *ParamsHandler) WriteFileContent(ctx context.Context, sourceID string, filename string, content io.Reader, size int64, opts WriteOptions) error

func (*ParamsHandler) WriteFilePart

func (h *ParamsHandler) WriteFilePart(ctx context.Context, sessionID string, content io.Reader, size int64, info ContentPartInfo, opts WriteFilePartOptions) (int64, error)

type ReadOptions

type ReadOptions struct {
	Range ContentRange `json:"range,omitempty"`
}

type ReadRequest

type ReadRequest struct {
	AccessID string
	Path     string
	Offset   int64
	Length   int64
}

type ReadResponse

type ReadResponse struct {
	Data   io.ReadCloser
	Length int64
}

type RenameFileOptions

type RenameFileOptions struct{}

type RouteOption

type RouteOption func(*routesOptions)

type RouteProviderFunc

type RouteProviderFunc func(opts ...RouteOption) Handler

func (RouteProviderFunc) GetHandler

func (f RouteProviderFunc) GetHandler(opts ...RouteOption) Handler

type Router

type Router interface {
	// GetHandler returns a sequence of handler
	GetHandler(opts ...RouteOption) Handler
}

func DefaultFilesRouter

func DefaultFilesRouter() Router

type RouterProvideFunc

type RouterProvideFunc func(ctx context.Context) Router

func (RouterProvideFunc) GetRouter

func (f RouterProvideFunc) GetRouter(ctx context.Context) Router

type RouterProvider

type RouterProvider interface {
	//GetRouter returns a router
	GetRouter(ctx context.Context) Router
}

type ServiceClientHandler

type ServiceClientHandler struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*ServiceClientHandler) CloseMultipartSession

func (h *ServiceClientHandler) CloseMultipartSession(ctx context.Context, sessionId string, _ CloseMultipartSessionOptions) error

func (*ServiceClientHandler) CopyFile

func (h *ServiceClientHandler) CopyFile(ctx context.Context, accessID string, filename string, dirname string, _ CopyFileOptions) error

func (*ServiceClientHandler) CreateAccess

func (h *ServiceClientHandler) CreateAccess(ctx context.Context, source *pb.FSAccess, _ CreateAccessOptions) error

func (*ServiceClientHandler) CreateDir

func (h *ServiceClientHandler) CreateDir(ctx context.Context, accessID string, dirname string, _ CreateDirOptions) error

func (*ServiceClientHandler) DeleteAccess

func (h *ServiceClientHandler) DeleteAccess(ctx context.Context, accessID string, _ DeleteAccessOptions) error

func (*ServiceClientHandler) DeleteFile

func (h *ServiceClientHandler) DeleteFile(ctx context.Context, accessID string, filename string, _ DeleteFileOptions) error

func (*ServiceClientHandler) GetAccess

func (h *ServiceClientHandler) GetAccess(ctx context.Context, accessID string, _ GetAccessOptions) (*pb.FSAccess, error)

func (*ServiceClientHandler) GetAccessList

func (h *ServiceClientHandler) GetAccessList(ctx context.Context, _ GetAccessListOptions) ([]*pb.FSAccess, error)

func (*ServiceClientHandler) GetFileAttributes

func (h *ServiceClientHandler) GetFileAttributes(ctx context.Context, accessID string, filename string, names []string, _ GetFileAttributesOptions) (Attributes, error)

func (*ServiceClientHandler) GetFileInfo

func (h *ServiceClientHandler) GetFileInfo(ctx context.Context, accessID string, filename string, opts GetFileOptions) (*pb.File, error)

func (*ServiceClientHandler) ListDir

func (h *ServiceClientHandler) ListDir(ctx context.Context, accessID string, dirname string, _ ListDirOptions) (*DirContent, error)

func (*ServiceClientHandler) MoveFile

func (h *ServiceClientHandler) MoveFile(ctx context.Context, accessID string, filename string, dirname string, _ MoveFileOptions) error

func (*ServiceClientHandler) OpenMultipartSession

func (h *ServiceClientHandler) OpenMultipartSession(ctx context.Context, accessID string, filename string, _ MultipartSessionInfo, _ OpenMultipartSessionOptions) (string, error)

func (*ServiceClientHandler) ReadFileContent

func (h *ServiceClientHandler) ReadFileContent(ctx context.Context, accessID string, filename string, opts ReadOptions) (io.ReadCloser, int64, error)

func (*ServiceClientHandler) RenameFile

func (h *ServiceClientHandler) RenameFile(ctx context.Context, accessID string, filename string, newName string, _ RenameFileOptions) error

func (*ServiceClientHandler) SetFileAttributes

func (h *ServiceClientHandler) SetFileAttributes(ctx context.Context, accessID string, filename string, attrs Attributes, _ SetFileAttributesOptions) error

func (*ServiceClientHandler) WriteFileContent

func (h *ServiceClientHandler) WriteFileContent(ctx context.Context, accessID string, filename string, content io.Reader, size int64, opts WriteOptions) error

func (*ServiceClientHandler) WriteFilePart

func (h *ServiceClientHandler) WriteFilePart(ctx context.Context, sessionID string, content io.Reader, size int64, _ ContentPartInfo, _ WriteFilePartOptions) (int64, error)

type SetFileAttributesOptions

type SetFileAttributesOptions struct{}

type ShareOptions

type ShareOptions struct{}

type SourcesServiceClientProvider

type SourcesServiceClientProvider interface {
	GetClient(ctx context.Context, serviceType uint32) (pb.AccessManagerClient, error)
}

func GetSourcesServiceClientProvider

func GetSourcesServiceClientProvider(ctx context.Context) SourcesServiceClientProvider

type TransferClient

type TransferClient interface {
	ReadFile(ctx context.Context, request *ReadRequest) (*ReadResponse, error)
	WriteFile(ctx context.Context, request *WriteRequest) (*WriteResponse, error)
	OpenFileMultipartWriteSession(ctx context.Context, request *OpenMultipartSessionRequest) (*OpenMultipartSessionResponse, error)
	WriteFilePart(ctx context.Context, request *WriteFilePartRequest) (*WritePartResponse, error)
	CloseFileMultipartWriteSession(ctx context.Context, request *CloseMultipartWriteSessionRequest) (*CloseMultipartWriteSessionResponse, error)
}

func NewTransfersServiceClient

func NewTransfersServiceClient(ctx context.Context, serviceType uint32) (TransferClient, error)

NewTransfersServiceClient is a source service client constructor

type TransfersServiceClientProvider

type TransfersServiceClientProvider interface {
	GetClient(ctx context.Context, serviceType uint32) (TransferClient, error)
}

func GetTransfersServiceClientProvider

func GetTransfersServiceClientProvider(ctx context.Context) TransfersServiceClientProvider

type TreePatchInfo

type TreePatchInfo struct {
	Rename bool   `json:"rename,omitempty"`
	Value  string `json:"value,omitempty"`
}

type WriteFilePartOptions

type WriteFilePartOptions struct{}

type WriteFilePartRequest

type WriteFilePartRequest struct {
	SessionId string
	Data      io.Reader
	Length    int64
}

type WriteOptions

type WriteOptions struct {
	Append bool   `json:"append,omitempty"`
	Hash   string `json:"hash,omitempty"`
}

type WritePartResponse

type WritePartResponse struct {
	Written int64
}

type WriteRequest

type WriteRequest struct {
	AccessID string
	Path     string
	Data     io.Reader
	Length   int64
	Append   bool
}

type WriteResponse

type WriteResponse struct {
	Written int64
}

Jump to

Keyboard shortcuts

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