views

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2018 License: AGPL-3.0 Imports: 50 Imported by: 0

Documentation

Overview

Package views provides high-level clients for talking to the main data tree in certain context.

It follows the "wrapper" pattern of http handlers to filter all requests inputs and outputs. The "Router" is object is used by all services or gateways when accessing to data as a given user. Between others, it will - Load ACLs and perform checks to make sure user is allowed to read/write the data - Perform other meta-related or acl-related checks like Quota management, locks, etc.. - Perform encryption/decryption of actual data on the fly - Compress / Decompress archives, - Add metadata collected from any services on the nodes outputted by the responses, - etc...

Index

Constants

View Source
const (
	VIEWS_LIBRARY_NAME = "pydio.lib.views"
)

Variables

View Source
var (
	// IsUnitTestEnv flag prevents among others the ClientPool to look for declared
	// datasources in the registry. As none is present while running unit tests, it
	// otherwise times out.
	IsUnitTestEnv = false
)

Functions

func AccessListFromContext

func AccessListFromContext(ctx context.Context) (*utils.AccessList, error)

func AncestorsListFromContext

func AncestorsListFromContext(ctx context.Context, node *tree.Node, identifier string, p *ClientsPool, orParents bool) (updatedContext context.Context, parentsList []*tree.Node, e error)

func GetGenericStoreClient

func GetGenericStoreClient(ctx context.Context, storeNamespace string, microClient client.Client) (client *minio.Core, bucket string, e error)

func GetGenericStoreClientConfig

func GetGenericStoreClientConfig(storeNamespace string) (dataSource string, bucket string, e error)

func MinioMetaFromContext

func MinioMetaFromContext(ctx context.Context) (md map[string]string, ok bool)

MinioMetaFromContext prepares metadata for minio client, merging context medata and eventually the Context User Key value (X-Pydio-User). Used to prepare metadata sent by Minio Clients

func UserWorkspacesFromContext

func UserWorkspacesFromContext(ctx context.Context) map[string]*idm.Workspace

func WithBranchInfo

func WithBranchInfo(ctx context.Context, identifier string, branchInfo BranchInfo) context.Context

Types

type AbstractBranchFilter

type AbstractBranchFilter struct {
	AbstractHandler

	RootNodesCache *cache.Cache
	// contains filtered or unexported fields
}

func (*AbstractBranchFilter) CopyObject

func (v *AbstractBranchFilter) CopyObject(ctx context.Context, from *tree.Node, to *tree.Node, requestData *CopyRequestData) (int64, error)

func (*AbstractBranchFilter) CreateNode

func (*AbstractBranchFilter) DeleteNode

func (*AbstractBranchFilter) ExecuteWrapped

func (v *AbstractBranchFilter) ExecuteWrapped(inputFilter NodeFilter, outputFilter NodeFilter, provider NodesCallback) error

func (*AbstractBranchFilter) GetObject

func (v *AbstractBranchFilter) GetObject(ctx context.Context, node *tree.Node, requestData *GetRequestData) (io.ReadCloser, error)

func (*AbstractBranchFilter) ListNodes

func (*AbstractBranchFilter) MultipartAbort

func (v *AbstractBranchFilter) MultipartAbort(ctx context.Context, node *tree.Node, uploadID string, requestData *MultipartRequestData) error

func (*AbstractBranchFilter) MultipartComplete

func (v *AbstractBranchFilter) MultipartComplete(ctx context.Context, node *tree.Node, uploadID string, uploadedParts []minio.CompletePart) (minio.ObjectInfo, error)

func (*AbstractBranchFilter) MultipartCreate

func (v *AbstractBranchFilter) MultipartCreate(ctx context.Context, node *tree.Node, requestData *MultipartRequestData) (string, error)

func (*AbstractBranchFilter) MultipartListObjectParts

func (v *AbstractBranchFilter) MultipartListObjectParts(ctx context.Context, node *tree.Node, uploadID string, partNumberMarker int, maxParts int) (lpi minio.ListObjectPartsResult, er error)

func (*AbstractBranchFilter) MultipartPutObjectPart

func (v *AbstractBranchFilter) MultipartPutObjectPart(ctx context.Context, node *tree.Node, uploadID string, partNumberMarker int, reader io.Reader, requestData *PutRequestData) (minio.ObjectPart, error)

func (*AbstractBranchFilter) PutObject

func (v *AbstractBranchFilter) PutObject(ctx context.Context, node *tree.Node, reader io.Reader, requestData *PutRequestData) (int64, error)

func (*AbstractBranchFilter) ReadNode

func (*AbstractBranchFilter) UpdateNode

type AbstractHandler

type AbstractHandler struct {
	CtxWrapper ContextWrapper
	// contains filtered or unexported fields
}

Abstract Handler implementation simply forwards calls to the next handler

func (*AbstractHandler) CopyObject

func (a *AbstractHandler) CopyObject(ctx context.Context, from *tree.Node, to *tree.Node, requestData *CopyRequestData) (int64, error)

func (*AbstractHandler) CreateNode

func (*AbstractHandler) DeleteNode

func (*AbstractHandler) ExecuteWrapped

func (a *AbstractHandler) ExecuteWrapped(inputFilter NodeFilter, outputFilter NodeFilter, provider NodesCallback) error

func (*AbstractHandler) GetObject

func (a *AbstractHandler) GetObject(ctx context.Context, node *tree.Node, requestData *GetRequestData) (io.ReadCloser, error)

func (*AbstractHandler) ListNodes

func (*AbstractHandler) MultipartAbort

func (a *AbstractHandler) MultipartAbort(ctx context.Context, target *tree.Node, uploadID string, requestData *MultipartRequestData) error

func (*AbstractHandler) MultipartComplete

func (a *AbstractHandler) MultipartComplete(ctx context.Context, target *tree.Node, uploadID string, uploadedParts []minio.CompletePart) (minio.ObjectInfo, error)

func (*AbstractHandler) MultipartCreate

func (a *AbstractHandler) MultipartCreate(ctx context.Context, target *tree.Node, requestData *MultipartRequestData) (string, error)

func (*AbstractHandler) MultipartList

func (a *AbstractHandler) MultipartList(ctx context.Context, prefix string, requestData *MultipartRequestData) (minio.ListMultipartUploadsResult, error)

func (*AbstractHandler) MultipartListObjectParts

func (a *AbstractHandler) MultipartListObjectParts(ctx context.Context, target *tree.Node, uploadID string, partNumberMarker int, maxParts int) (minio.ListObjectPartsResult, error)

func (*AbstractHandler) MultipartPutObjectPart

func (a *AbstractHandler) MultipartPutObjectPart(ctx context.Context, target *tree.Node, uploadID string, partNumberMarker int, reader io.Reader, requestData *PutRequestData) (minio.ObjectPart, error)

func (*AbstractHandler) PutObject

func (a *AbstractHandler) PutObject(ctx context.Context, node *tree.Node, reader io.Reader, requestData *PutRequestData) (int64, error)

func (*AbstractHandler) ReadNode

func (*AbstractHandler) SetClientsPool

func (a *AbstractHandler) SetClientsPool(p *ClientsPool)

func (*AbstractHandler) SetNextHandler

func (a *AbstractHandler) SetNextHandler(h Handler)

func (*AbstractHandler) UpdateNode

type AccessListHandler

type AccessListHandler struct {
	AbstractHandler
}

func NewAccessListHandler

func NewAccessListHandler(adminView bool) *AccessListHandler

type AclFilterHandler

type AclFilterHandler struct {
	AbstractHandler
}

func (*AclFilterHandler) CopyObject

func (a *AclFilterHandler) CopyObject(ctx context.Context, from *tree.Node, to *tree.Node, requestData *CopyRequestData) (int64, error)

func (*AclFilterHandler) CreateNode

func (*AclFilterHandler) DeleteNode

func (*AclFilterHandler) GetObject

func (a *AclFilterHandler) GetObject(ctx context.Context, node *tree.Node, requestData *GetRequestData) (io.ReadCloser, error)

func (*AclFilterHandler) ListNodes

func (*AclFilterHandler) PutObject

func (a *AclFilterHandler) PutObject(ctx context.Context, node *tree.Node, reader io.Reader, requestData *PutRequestData) (int64, error)

func (*AclFilterHandler) ReadNode

Check if node is readable and forward to next middleware

func (*AclFilterHandler) UpdateNode

type AclLockFilter

type AclLockFilter struct {
	AbstractHandler
}

func (*AclLockFilter) CopyObject

func (a *AclLockFilter) CopyObject(ctx context.Context, from *tree.Node, to *tree.Node, requestData *CopyRequestData) (int64, error)

CopyObject should check: quota on CopyObject operation? Can we copy an object on top of an existing node?

func (*AclLockFilter) MultipartCreate

func (a *AclLockFilter) MultipartCreate(ctx context.Context, target *tree.Node, requestData *MultipartRequestData) (string, error)

func (*AclLockFilter) PutObject

func (a *AclLockFilter) PutObject(ctx context.Context, node *tree.Node, reader io.Reader, requestData *PutRequestData) (int64, error)

PutObject check locks before allowing Put operation.

type AclQuotaFilter

type AclQuotaFilter struct {
	AbstractHandler
}

func (*AclQuotaFilter) ComputeQuota

func (a *AclQuotaFilter) ComputeQuota(ctx context.Context, workspace *idm.Workspace) (quota int64, usage int64, err error)

func (*AclQuotaFilter) CopyObject

func (a *AclQuotaFilter) CopyObject(ctx context.Context, from *tree.Node, to *tree.Node, requestData *CopyRequestData) (int64, error)

CopyObject checks quota on CopyObject operation.

func (*AclQuotaFilter) FindParentWorkspaces

func (a *AclQuotaFilter) FindParentWorkspaces(ctx context.Context, workspace *idm.Workspace) (parentWorkspaces []*idm.Workspace, parentContext context.Context, err error)

FindParentWorkspaces finds possible parents for the current workspace based on the RESOURCE_OWNER uuid. TODO: add virtual nodes manager.

func (*AclQuotaFilter) MultipartPutObjectPart

func (a *AclQuotaFilter) MultipartPutObjectPart(ctx context.Context, target *tree.Node, uploadID string, partNumberMarker int, reader io.Reader, requestData *PutRequestData) (minio.ObjectPart, error)

MultipartPutObjectPart checks quota on MultipartPutObjectPart.

func (*AclQuotaFilter) PutObject

func (a *AclQuotaFilter) PutObject(ctx context.Context, node *tree.Node, reader io.Reader, requestData *PutRequestData) (int64, error)

PutObject checks quota on PutObject operation.

func (*AclQuotaFilter) QuotaForWorkspace

func (a *AclQuotaFilter) QuotaForWorkspace(ctx context.Context, workspace *idm.Workspace, orderedRoles []string) (maxQuota int64, currentUsage int64, err error)

QuotaForWorkspace finds quota and computes current usage from ACLs and Tree for a given workspace, in a specific context given by the orderedRoles list.

type ArchiveHandler

type ArchiveHandler struct {
	AbstractHandler
}

func (*ArchiveHandler) GetObject

func (a *ArchiveHandler) GetObject(ctx context.Context, node *tree.Node, requestData *GetRequestData) (io.ReadCloser, error)

Override the response of GetObject if it is sent on a folder key : create an archive on-the-fly.

func (*ArchiveHandler) ListNodes

func (*ArchiveHandler) ReadNode

Override the response of ReadNode to create a fake stat for archive file

type ArchiveReader

type ArchiveReader struct {
	Router Handler
}

func (*ArchiveReader) ExtractAllTar

func (a *ArchiveReader) ExtractAllTar(ctx context.Context, gzipFormat bool, archiveNode *tree.Node, targetNode *tree.Node, logChannels ...chan string) error

func (*ArchiveReader) ExtractAllZip

func (a *ArchiveReader) ExtractAllZip(ctx context.Context, archiveNode *tree.Node, targetNode *tree.Node, logChannels ...chan string) error

func (*ArchiveReader) ListChildrenTar

func (a *ArchiveReader) ListChildrenTar(ctx context.Context, gzipFormat bool, archiveNode *tree.Node, parentPath string, stat ...bool) ([]*tree.Node, error)

func (*ArchiveReader) ListChildrenZip

func (a *ArchiveReader) ListChildrenZip(ctx context.Context, archiveNode *tree.Node, parentPath string, stat ...bool) ([]*tree.Node, error)

func (*ArchiveReader) ReadChildTar

func (a *ArchiveReader) ReadChildTar(ctx context.Context, gzipFormat bool, writer io.WriteCloser, archiveNode *tree.Node, innerPath string) (int64, error)

func (*ArchiveReader) ReadChildZip

func (a *ArchiveReader) ReadChildZip(ctx context.Context, archiveNode *tree.Node, innerPath string) (io.ReadCloser, error)

func (*ArchiveReader) StatChildTar

func (a *ArchiveReader) StatChildTar(ctx context.Context, gzipFormat bool, archiveNode *tree.Node, innerPath string) (*tree.Node, error)

func (*ArchiveReader) StatChildZip

func (a *ArchiveReader) StatChildZip(ctx context.Context, archiveNode *tree.Node, innerPath string) (*tree.Node, error)

type ArchiveWriter

type ArchiveWriter struct {
	Router Handler
}

func (*ArchiveWriter) TarSelection

func (w *ArchiveWriter) TarSelection(ctx context.Context, output io.Writer, gzipFile bool, nodes []*tree.Node, logsChannel ...chan string) (int64, error)

func (*ArchiveWriter) ZipSelection

func (w *ArchiveWriter) ZipSelection(ctx context.Context, output io.Writer, nodes []*tree.Node, logsChannels ...chan string) (int64, error)

type BinaryStoreHandler

type BinaryStoreHandler struct {
	AbstractHandler
	StoreName     string
	AllowPut      bool
	AllowAnonRead bool
}

func (*BinaryStoreHandler) CopyObject

func (a *BinaryStoreHandler) CopyObject(ctx context.Context, from *tree.Node, to *tree.Node, requestData *CopyRequestData) (int64, error)

func (*BinaryStoreHandler) CreateNode

///////////////////////////// THIS STORE IS NOT WRITEABLE /////////////////////////////

func (*BinaryStoreHandler) DeleteNode

func (*BinaryStoreHandler) GetObject

func (a *BinaryStoreHandler) GetObject(ctx context.Context, node *tree.Node, requestData *GetRequestData) (io.ReadCloser, error)

func (*BinaryStoreHandler) ListNodes

Listing of Thumbs Store : do not display content

func (*BinaryStoreHandler) PutObject

func (a *BinaryStoreHandler) PutObject(ctx context.Context, node *tree.Node, reader io.Reader, requestData *PutRequestData) (int64, error)

func (*BinaryStoreHandler) ReadNode

Node Info & Node Content : send by UUID,

func (*BinaryStoreHandler) UpdateNode

type BranchInfo

type BranchInfo struct {
	LoadedSource
	idm.Workspace
	Root          *tree.Node
	Binary        bool
	AncestorsList []*tree.Node
}

These keys may be enriched in Context depending on the middleware

func GetBranchInfo

func GetBranchInfo(ctx context.Context, identifier string) (BranchInfo, bool)

type ClientsPool

type ClientsPool struct {
	Sources map[string]LoadedSource

	// Statically set for testing
	TreeClient      tree.NodeProviderClient
	TreeClientWrite tree.NodeReceiverClient
	// contains filtered or unexported fields
}

ClientsPool is responsible for discovering available datasources and keeping an up to date registry that is used by the routers.

func NewClientsPool

func NewClientsPool(watchRegistry bool) (pool *ClientsPool)

NewClientsPool creates a client pool and initialises it by calling the registry.

func (*ClientsPool) Close

func (p *ClientsPool) Close()

Close stops the underlying watcher if defined.

func (*ClientsPool) GetDataSourceInfo

func (p *ClientsPool) GetDataSourceInfo(dsName string, retries ...int) (LoadedSource, error)

func (*ClientsPool) GetTreeClient

func (p *ClientsPool) GetTreeClient() tree.NodeProviderClient

func (*ClientsPool) GetTreeClientWrite

func (p *ClientsPool) GetTreeClientWrite() tree.NodeReceiverClient

type ContextWrapper

type ContextWrapper func(ctx context.Context) (context.Context, error)

type CopyRequestData

type CopyRequestData struct {
	Metadata map[string]string

	SrcVersionId string
	// contains filtered or unexported fields
}

These keys may be enriched in Context depending on the middleware

type EncryptionHandler

type EncryptionHandler struct {
	AbstractHandler
}

EncryptionHandler encryption node middleware

func (*EncryptionHandler) CopyObject

func (e *EncryptionHandler) CopyObject(ctx context.Context, from *tree.Node, to *tree.Node, requestData *CopyRequestData) (int64, error)

CopyObject Enriches request metadata for CopyObject with Encryption Materials, if required by datasource

func (*EncryptionHandler) GetObject

func (e *EncryptionHandler) GetObject(ctx context.Context, node *tree.Node, requestData *GetRequestData) (io.ReadCloser, error)

GetObject Enriches request metadata for GetObject with Encryption Materials, if required by datasource

func (*EncryptionHandler) PutObject

func (e *EncryptionHandler) PutObject(ctx context.Context, node *tree.Node, reader io.Reader, requestData *PutRequestData) (int64, error)

PutObject Enriches request metadata for PutObject with Encryption Materials, if required by datasource

type Executor

type Executor struct {
	AbstractHandler
}

func (*Executor) CopyObject

func (e *Executor) CopyObject(ctx context.Context, from *tree.Node, to *tree.Node, requestData *CopyRequestData) (int64, error)

func (*Executor) CreateNode

func (*Executor) DeleteNode

func (*Executor) ExecuteWrapped

func (a *Executor) ExecuteWrapped(inputFilter NodeFilter, outputFilter NodeFilter, provider NodesCallback) error

func (*Executor) GetObject

func (e *Executor) GetObject(ctx context.Context, node *tree.Node, requestData *GetRequestData) (io.ReadCloser, error)

func (*Executor) ListNodes

func (*Executor) MultipartAbort

func (e *Executor) MultipartAbort(ctx context.Context, target *tree.Node, uploadID string, requestData *MultipartRequestData) error

func (*Executor) MultipartComplete

func (e *Executor) MultipartComplete(ctx context.Context, target *tree.Node, uploadID string, uploadedParts []minio.CompletePart) (minio.ObjectInfo, error)

func (*Executor) MultipartCreate

func (e *Executor) MultipartCreate(ctx context.Context, target *tree.Node, requestData *MultipartRequestData) (string, error)

func (*Executor) MultipartList

func (e *Executor) MultipartList(ctx context.Context, prefix string, requestData *MultipartRequestData) (res minio.ListMultipartUploadsResult, err error)

func (*Executor) MultipartListObjectParts

func (e *Executor) MultipartListObjectParts(ctx context.Context, target *tree.Node, uploadID string, partNumberMarker int, maxParts int) (lpi minio.ListObjectPartsResult, err error)

func (*Executor) MultipartPutObjectPart

func (e *Executor) MultipartPutObjectPart(ctx context.Context, target *tree.Node, uploadID string, partNumberMarker int, reader io.Reader, requestData *PutRequestData) (minio.ObjectPart, error)

func (*Executor) PutObject

func (e *Executor) PutObject(ctx context.Context, node *tree.Node, reader io.Reader, requestData *PutRequestData) (int64, error)

func (*Executor) ReadNode

func (*Executor) UpdateNode

type GetRequestData

type GetRequestData struct {
	StartOffset        int64
	Length             int64
	EncryptionMaterial encrypt.Materials
	VersionId          string
}

These keys may be enriched in Context depending on the middleware

type Handler

type Handler interface {
	tree.NodeProviderClient
	tree.NodeReceiverClient
	GetObject(ctx context.Context, node *tree.Node, requestData *GetRequestData) (io.ReadCloser, error)
	PutObject(ctx context.Context, node *tree.Node, reader io.Reader, requestData *PutRequestData) (int64, error)
	CopyObject(ctx context.Context, from *tree.Node, to *tree.Node, requestData *CopyRequestData) (int64, error)

	MultipartCreate(ctx context.Context, target *tree.Node, requestData *MultipartRequestData) (string, error)
	MultipartPutObjectPart(ctx context.Context, target *tree.Node, uploadID string, partNumberMarker int, reader io.Reader, requestData *PutRequestData) (minio.ObjectPart, error)
	MultipartList(ctx context.Context, prefix string, requestData *MultipartRequestData) (minio.ListMultipartUploadsResult, error)
	MultipartAbort(ctx context.Context, target *tree.Node, uploadID string, requestData *MultipartRequestData) error
	MultipartComplete(ctx context.Context, target *tree.Node, uploadID string, uploadedParts []minio.CompletePart) (minio.ObjectInfo, error)
	MultipartListObjectParts(ctx context.Context, target *tree.Node, uploadID string, partNumberMarker int, maxParts int) (minio.ListObjectPartsResult, error)

	ExecuteWrapped(inputFilter NodeFilter, outputFilter NodeFilter, provider NodesCallback) error

	SetNextHandler(h Handler)
	SetClientsPool(p *ClientsPool)
}

type HandlerAuditEvent

type HandlerAuditEvent struct {
	AbstractHandler
}

HandlerAuditEvent is responsible for auditing all events on Nodes as soon as the router's option flag "AuditEvent" is set to true.

func (*HandlerAuditEvent) CopyObject

func (h *HandlerAuditEvent) CopyObject(ctx context.Context, from *tree.Node, to *tree.Node, requestData *CopyRequestData) (int64, error)

func (*HandlerAuditEvent) CreateNode

CreateNode logs an audit message on each call after having transferred the call to following handlers.

func (*HandlerAuditEvent) DeleteNode

DeleteNode logs an audit message on each call after having transferred the call to following handlers.

func (*HandlerAuditEvent) GetObject

func (h *HandlerAuditEvent) GetObject(ctx context.Context, node *tree.Node, requestData *GetRequestData) (io.ReadCloser, error)

GetObject logs an audit message on each GetObject Events after calling following handlers.

func (*HandlerAuditEvent) ListNodes

ListNodes logs an audit message on each call after having transferred the call to following handlers.

func (*HandlerAuditEvent) MultipartAbort

func (h *HandlerAuditEvent) MultipartAbort(ctx context.Context, target *tree.Node, uploadID string, requestData *MultipartRequestData) error

func (*HandlerAuditEvent) MultipartComplete

func (h *HandlerAuditEvent) MultipartComplete(ctx context.Context, target *tree.Node, uploadID string, uploadedParts []minio.CompletePart) (minio.ObjectInfo, error)

func (*HandlerAuditEvent) MultipartCreate

func (h *HandlerAuditEvent) MultipartCreate(ctx context.Context, target *tree.Node, requestData *MultipartRequestData) (string, error)

func (*HandlerAuditEvent) MultipartList

func (h *HandlerAuditEvent) MultipartList(ctx context.Context, prefix string, requestData *MultipartRequestData) (minio.ListMultipartUploadsResult, error)

func (*HandlerAuditEvent) MultipartListObjectParts

func (h *HandlerAuditEvent) MultipartListObjectParts(ctx context.Context, target *tree.Node, uploadID string, partNumberMarker int, maxParts int) (minio.ListObjectPartsResult, error)

func (*HandlerAuditEvent) MultipartPutObjectPart

func (h *HandlerAuditEvent) MultipartPutObjectPart(ctx context.Context, target *tree.Node, uploadID string, partNumberMarker int, reader io.Reader, requestData *PutRequestData) (minio.ObjectPart, error)

func (*HandlerAuditEvent) PutObject

func (h *HandlerAuditEvent) PutObject(ctx context.Context, node *tree.Node, reader io.Reader, requestData *PutRequestData) (int64, error)

PutObject logs an audit message after calling following handlers.

func (*HandlerAuditEvent) ReadNode

ReadNode only forwards call to next handler, it call too often to provide useful audit info.

func (*HandlerAuditEvent) UpdateNode

UpdateNode logs an audit message on each call after having transferred the call to following handlers.

type HandlerEventRead

type HandlerEventRead struct {
	AbstractHandler
}

func (*HandlerEventRead) GetObject

func (h *HandlerEventRead) GetObject(ctx context.Context, node *tree.Node, requestData *GetRequestData) (io.ReadCloser, error)

func (*HandlerEventRead) ListNodes

type HandlerMock

type HandlerMock struct {
	Nodes   map[string]*tree.Node
	Context context.Context
}

func NewHandlerMock

func NewHandlerMock() *HandlerMock

func (*HandlerMock) CopyObject

func (h *HandlerMock) CopyObject(ctx context.Context, from *tree.Node, to *tree.Node, requestData *CopyRequestData) (int64, error)

func (*HandlerMock) CreateNode

func (*HandlerMock) DeleteNode

func (*HandlerMock) ExecuteWrapped

func (h *HandlerMock) ExecuteWrapped(inputFilter NodeFilter, outputFilter NodeFilter, provider NodesCallback) error

func (*HandlerMock) GetObject

func (h *HandlerMock) GetObject(ctx context.Context, node *tree.Node, requestData *GetRequestData) (io.ReadCloser, error)

func (*HandlerMock) ListNodes

func (*HandlerMock) MultipartAbort

func (h *HandlerMock) MultipartAbort(ctx context.Context, target *tree.Node, uploadID string, requestData *MultipartRequestData) error

func (*HandlerMock) MultipartComplete

func (h *HandlerMock) MultipartComplete(ctx context.Context, target *tree.Node, uploadID string, uploadedParts []minio.CompletePart) (minio.ObjectInfo, error)

func (*HandlerMock) MultipartCreate

func (h *HandlerMock) MultipartCreate(ctx context.Context, target *tree.Node, requestData *MultipartRequestData) (string, error)

func (*HandlerMock) MultipartList

func (h *HandlerMock) MultipartList(ctx context.Context, prefix string, requestData *MultipartRequestData) (minio.ListMultipartUploadsResult, error)

func (*HandlerMock) MultipartListObjectParts

func (h *HandlerMock) MultipartListObjectParts(ctx context.Context, target *tree.Node, uploadID string, partNumberMarker int, maxParts int) (minio.ListObjectPartsResult, error)

func (*HandlerMock) MultipartPutObjectPart

func (h *HandlerMock) MultipartPutObjectPart(ctx context.Context, target *tree.Node, uploadID string, partNumberMarker int, reader io.Reader, requestData *PutRequestData) (op minio.ObjectPart, e error)

func (*HandlerMock) PutObject

func (h *HandlerMock) PutObject(ctx context.Context, node *tree.Node, reader io.Reader, requestData *PutRequestData) (int64, error)

func (*HandlerMock) ReadNode

func (*HandlerMock) SetClientsPool

func (h *HandlerMock) SetClientsPool(p *ClientsPool)

func (*HandlerMock) SetNextHandler

func (h *HandlerMock) SetNextHandler(handler Handler)

func (*HandlerMock) UpdateNode

type LoadedSource

type LoadedSource struct {
	object.DataSource
	Client *minio.Core
}

These keys may be enriched in Context depending on the middleware

func NewSource

func NewSource(data *object.DataSource) (LoadedSource, error)

NewSource instantiates a LoadedSource with a minio client

type MockReadCloser

type MockReadCloser struct {
	io.Reader
}

func (MockReadCloser) Close

func (r MockReadCloser) Close() error

type MultipartRequestData

type MultipartRequestData struct {
	Metadata map[string]string

	ListKeyMarker      string
	ListUploadIDMarker string
	ListDelimiter      string
	ListMaxUploads     int
}

These keys may be enriched in Context depending on the middleware

type MultipleRootsHandler

type MultipleRootsHandler struct {
	AbstractBranchFilter
}

func NewPathMultipleRootsHandler

func NewPathMultipleRootsHandler() *MultipleRootsHandler

func (*MultipleRootsHandler) ListNodes

func (*MultipleRootsHandler) ReadNode

type NodeFilter

type NodeFilter func(ctx context.Context, inputNode *tree.Node, identifier string) (context.Context, *tree.Node, error)

type NodesCallback

type NodesCallback func(inputFilter NodeFilter, outputFilter NodeFilter) error

type PathDataSourceHandler

type PathDataSourceHandler struct {
	AbstractBranchFilter
}

func NewPathDataSourceHandler

func NewPathDataSourceHandler() *PathDataSourceHandler

type PathWorkspaceHandler

type PathWorkspaceHandler struct {
	AbstractBranchFilter
}

func NewPathWorkspaceHandler

func NewPathWorkspaceHandler() *PathWorkspaceHandler

func (*PathWorkspaceHandler) ListNodes

func (*PathWorkspaceHandler) ReadNode

type PutHandler

type PutHandler struct {
	AbstractHandler
}

func (*PutHandler) CreateParent

func (m *PutHandler) CreateParent(ctx context.Context, node *tree.Node) error

Recursively create parents

func (*PutHandler) GetOrCreatePutNode

func (m *PutHandler) GetOrCreatePutNode(ctx context.Context, nodePath string, size int64) (*tree.Node, error, onCreateErrorFunc)

Create a temporary node before calling a Put request. If it is an update, should send back the already existing node Returns the node, a flag to tell wether it is created or not, and eventually an error The Put event will afterward update the index

func (*PutHandler) MultipartCreate

func (m *PutHandler) MultipartCreate(ctx context.Context, node *tree.Node, requestData *MultipartRequestData) (string, error)

MultipartCreate registers a node in the virtual fs with size 0 and ETag: temporary (we do not have the real size at this point because we are using streams.)

func (*PutHandler) PutObject

func (m *PutHandler) PutObject(ctx context.Context, node *tree.Node, reader io.Reader, requestData *PutRequestData) (int64, error)

type PutRequestData

type PutRequestData struct {
	Size               int64
	Md5Sum             []byte
	Sha256Sum          []byte
	Metadata           map[string]string
	EncryptionMaterial encrypt.Materials
	MultipartUploadID  string
	MultipartPartID    int
}

These keys may be enriched in Context depending on the middleware

type Router

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

func NewRouter

func NewRouter(pool *ClientsPool, handlers []Handler) *Router

NewRouter creates and configures a new router with given ClientsPool and Handlers.

func NewStandardRouter

func NewStandardRouter(options RouterOptions) *Router

NewStandardRouter returns a new configured instance of the default standard router.

func NewUuidRouter

func NewUuidRouter(options RouterOptions) *Router

NewUuidRouter returns a new configured instance of a router that relies on nodes UUID rather than the usual Node path.

func (*Router) CopyObject

func (v *Router) CopyObject(ctx context.Context, from *tree.Node, to *tree.Node, requestData *CopyRequestData) (int64, error)

func (*Router) CreateNode

func (*Router) DeleteNode

func (*Router) ExecuteWrapped

func (v *Router) ExecuteWrapped(inputFilter NodeFilter, outputFilter NodeFilter, provider NodesCallback) error

func (*Router) GetClientsPool

func (v *Router) GetClientsPool() *ClientsPool

Specific to Router

func (*Router) GetExecutor

func (v *Router) GetExecutor() Handler

GetExecutor uses the very last handler (Executor) to send a request with a previously filled context.

func (*Router) GetObject

func (v *Router) GetObject(ctx context.Context, node *tree.Node, requestData *GetRequestData) (io.ReadCloser, error)

func (*Router) ListNodes

func (*Router) MultipartAbort

func (v *Router) MultipartAbort(ctx context.Context, target *tree.Node, uploadID string, requestData *MultipartRequestData) error

func (*Router) MultipartComplete

func (v *Router) MultipartComplete(ctx context.Context, target *tree.Node, uploadID string, uploadedParts []minio.CompletePart) (minio.ObjectInfo, error)

func (*Router) MultipartCreate

func (v *Router) MultipartCreate(ctx context.Context, target *tree.Node, requestData *MultipartRequestData) (string, error)

func (*Router) MultipartList

func (v *Router) MultipartList(ctx context.Context, prefix string, requestData *MultipartRequestData) (minio.ListMultipartUploadsResult, error)

func (*Router) MultipartListObjectParts

func (v *Router) MultipartListObjectParts(ctx context.Context, target *tree.Node, uploadID string, partNumberMarker int, maxParts int) (minio.ListObjectPartsResult, error)

func (*Router) MultipartPutObjectPart

func (v *Router) MultipartPutObjectPart(ctx context.Context, target *tree.Node, uploadID string, partNumberMarker int, reader io.Reader, requestData *PutRequestData) (minio.ObjectPart, error)

func (*Router) PutObject

func (v *Router) PutObject(ctx context.Context, node *tree.Node, reader io.Reader, requestData *PutRequestData) (int64, error)

func (*Router) ReadNode

func (*Router) SetClientsPool

func (v *Router) SetClientsPool(p *ClientsPool)

func (*Router) SetNextHandler

func (v *Router) SetNextHandler(h Handler)

To respect Handler interface

func (*Router) UpdateNode

func (*Router) WrapCallback

func (v *Router) WrapCallback(provider NodesCallback) error

type RouterEventFilter

type RouterEventFilter struct {
	Router
	//RootNodesCache map[string]*tree.Node
	RootNodesCache *cache.Cache
}

Extended Router used mainly to filter events sent from inside to outside the application

func NewRouterEventFilter

func NewRouterEventFilter(options RouterOptions) *RouterEventFilter

NewRouterEventFilter creates a new EventFilter properly initialized

func (*RouterEventFilter) NodeIsChildOfRoot

func (r *RouterEventFilter) NodeIsChildOfRoot(ctx context.Context, node *tree.Node, rootId string) (*tree.Node, bool)

NodeIsChildOfRoot compares pathes between possible parent and child

func (*RouterEventFilter) WorkspaceCanSeeNode

func (r *RouterEventFilter) WorkspaceCanSeeNode(ctx context.Context, workspace *idm.Workspace, node *tree.Node, refresh bool) (*tree.Node, bool)

WorkspaceCanSeeNode will check workspaces roots to see if a node in below one of them

type RouterOptions

type RouterOptions struct {
	AdminView          bool
	WatchRegistry      bool
	LogReadEvents      bool
	BrowseVirtualNodes bool
	// AuditEvent flag turns audit logger ON for the corresponding router.
	AuditEvent bool
}

RouterOptions holds configuration flags to pass to a routeur constructor easily.

type UploadLimitFilter

type UploadLimitFilter struct {
	AbstractHandler
}

func (*UploadLimitFilter) MultipartPutObjectPart

func (a *UploadLimitFilter) MultipartPutObjectPart(ctx context.Context, target *tree.Node, uploadID string, partNumberMarker int, reader io.Reader, requestData *PutRequestData) (minio.ObjectPart, error)

Check Upload Limits (size, extension) defined in the frontend on MultipartPutObjectPart

func (*UploadLimitFilter) PutObject

func (a *UploadLimitFilter) PutObject(ctx context.Context, node *tree.Node, reader io.Reader, requestData *PutRequestData) (int64, error)

Check Upload Limits (size, extension) defined in the frontend on PutObject operation

type UuidDataSourceHandler

type UuidDataSourceHandler struct {
	AbstractBranchFilter
}

func NewUuidDataSourceHandler

func NewUuidDataSourceHandler() *UuidDataSourceHandler

type UuidNodeHandler

type UuidNodeHandler struct {
	AbstractBranchFilter
}

func NewUuidNodeHandler

func NewUuidNodeHandler() *UuidNodeHandler

type UuidRootsHandler

type UuidRootsHandler struct {
	AbstractBranchFilter
}

func NewUuidRootsHandler

func NewUuidRootsHandler() *UuidRootsHandler

type VersionHandler

type VersionHandler struct {
	AbstractHandler
	// contains filtered or unexported fields
}

func (*VersionHandler) CopyObject

func (v *VersionHandler) CopyObject(ctx context.Context, from *tree.Node, to *tree.Node, requestData *CopyRequestData) (int64, error)

Read from Version Store if request contains a VersionID

func (*VersionHandler) GetObject

func (v *VersionHandler) GetObject(ctx context.Context, node *tree.Node, requestData *GetRequestData) (io.ReadCloser, error)

Redirect to Version Store if request contains a VersionID

func (*VersionHandler) ListNodes

Create list of nodes if the Versions are required

func (*VersionHandler) ReadNode

type VirtualNodesBrowser

type VirtualNodesBrowser struct {
	AbstractHandler
}

func NewVirtualNodesBrowser

func NewVirtualNodesBrowser() *VirtualNodesBrowser

func (*VirtualNodesBrowser) ListNodes

ListNodes Append virtual nodes to the datasources list if admin is listing the root of the tree

func (*VirtualNodesBrowser) ReadNode

ReadNode creates a fake node if admin is reading info about a virtual node

type VirtualNodesManager

type VirtualNodesManager struct {
	VirtualNodes []*tree.Node
}

VirtualNodesManager keeps an internal list of virtual nodes. They are cached for one minute to avoid too many requests on docstore service.

func GetVirtualNodesManager

func GetVirtualNodesManager() *VirtualNodesManager

GetVirtualNodesManager creates a new VirtualNodesManager.

func (*VirtualNodesManager) ByPath

func (m *VirtualNodesManager) ByPath(path string) (*tree.Node, bool)

ByPath finds a VirtualNode by its Path.

func (*VirtualNodesManager) ByUuid

func (m *VirtualNodesManager) ByUuid(uuid string) (*tree.Node, bool)

ByUuid finds a VirtualNode by its Uuid.

func (*VirtualNodesManager) ListNodes

func (m *VirtualNodesManager) ListNodes() []*tree.Node

ListNodes simply returns the internally cached list.

func (*VirtualNodesManager) Load

func (m *VirtualNodesManager) Load()

Load requests the virtual nodes from the DocStore service.

func (*VirtualNodesManager) ResolveInContext

func (m *VirtualNodesManager) ResolveInContext(ctx context.Context, vNode *tree.Node, clientsPool *ClientsPool, create bool) (*tree.Node, error)

ResolveInContext computes the actual node Path based on the resolution metadata of the virtual node and the current metadata contained in context.

type VirtualNodesResolver

type VirtualNodesResolver struct {
	AbstractBranchFilter
}

func NewVirtualNodesHandler

func NewVirtualNodesHandler() *VirtualNodesResolver

type WorkspaceRootResolver

type WorkspaceRootResolver struct {
	AbstractBranchFilter
}

func NewWorkspaceRootResolver

func NewWorkspaceRootResolver() *WorkspaceRootResolver

type WrappingStreamer

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

func NewWrappingStreamer

func NewWrappingStreamer() *WrappingStreamer

func (*WrappingStreamer) Close

func (l *WrappingStreamer) Close() error

func (*WrappingStreamer) Recv

func (*WrappingStreamer) RecvMsg

func (l *WrappingStreamer) RecvMsg(interface{}) error

func (*WrappingStreamer) Send

func (*WrappingStreamer) SendError

func (l *WrappingStreamer) SendError(err error) error

func (*WrappingStreamer) SendMsg

func (l *WrappingStreamer) SendMsg(interface{}) error

Jump to

Keyboard shortcuts

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