views

package
v2.2.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: AGPL-3.0 Imports: 61 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) (*permissions.AccessList, error)

func AncestorsListFromContext

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

func BuildAncestorsList

func BuildAncestorsList(ctx context.Context, treeClient tree.NodeProviderClient, node *tree.Node) (parentUuids []*tree.Node, err error)

BuildAncestorsList uses ListNodes with "Ancestors" flag to build the list of parent nodes. It uses an internal short-lived cache to throttle calls to the TreeService

func BuildAncestorsListOrParent

func BuildAncestorsListOrParent(ctx context.Context, treeClient tree.NodeProviderClient, node *tree.Node) (parentUuids []*tree.Node, err error)

BuildAncestorsListOrParent builds ancestors list when the node does not exists yet, by trying to find all existing parents.

func CopyMoveNodes added in v1.5.0

func CopyMoveNodes(ctx context.Context, router Handler, sourceNode *tree.Node, targetNode *tree.Node, move bool, recursive bool, isTask bool, statusChan chan string, progressChan chan float32, tFunc ...i18n.TranslateFunc) (oErr error)

CopyMoveNodes performs a recursive copy or move operation of a node to a new location. It can be inter- or intra-datasources. It will eventually pass contextual metadata like X-Pydio-Session (to batch event inside the SYNC) or X-Pydio-Move (to reconciliate creates and deletes when move is done between two differing datasources).

func GetGenericStoreClient

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

GetGenericStoreClient creates a *minio.Core client for a given binary store.

func GetGenericStoreClientConfig

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

GetGenericStoreClientConfig finds datasource/bucket for a given store.

func GetSessionID

func GetSessionID(ctx context.Context) (string, bool)

GetSessionID returns the session ID in context

func NewCacheDiff added in v1.5.0

func NewCacheDiff() *cacheDiff

func NewMockNodeKeyManagerClient added in v1.5.0

func NewMockNodeKeyManagerClient() encryption.NodeKeyManagerClient

func NewMockUserKeyTool added in v1.5.0

func NewMockUserKeyTool() key.UserKeyTool

func UserWorkspacesFromContext

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

func WalkFilterSkipPydioHiddenFile

func WalkFilterSkipPydioHiddenFile(ctx context.Context, node *tree.Node) bool

func WithBranchInfo

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

func WithSessionID

func WithSessionID(ctx context.Context, session string) context.Context

WithSessionID returns a context which knows its service assigned color

Types

type AbstractBranchFilter

type AbstractBranchFilter struct {
	AbstractHandler

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

AbstractBranchFilter is a ready-made Handler that can be used by all handlers that just modify the path in one way or another before forwarding calls to next handler.

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
}

AbstractHandler provides the simplest implementation of Handler and forwards all 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) ListNodesWithCallback

func (a *AbstractHandler) ListNodesWithCallback(ctx context.Context, request *tree.ListNodesRequest, callback WalkFunc, ignoreCbError bool, filters ...WalkFilter) error

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 SourcesPool)

func (*AbstractHandler) SetNextHandler

func (a *AbstractHandler) SetNextHandler(h Handler)

func (*AbstractHandler) UpdateNode

func (*AbstractHandler) WrappedCanApply

func (a *AbstractHandler) WrappedCanApply(srcCtx context.Context, targetCtx context.Context, operation *tree.NodeChangeEvent) error

type AccessListHandler

type AccessListHandler struct {
	AbstractHandler
}

AccessListHandler appends permissions.AccessList to the context.

func NewAccessListHandler

func NewAccessListHandler(adminView bool) *AccessListHandler

NewAccessListHandler creates a new AccessListHandler

type AclContentLockFilter

type AclContentLockFilter struct {
	AbstractHandler
}

AclContentLockFilter checks for user-defined content locks in the context AccessList.

func (*AclContentLockFilter) CopyObject

func (a *AclContentLockFilter) 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 (*AclContentLockFilter) MultipartCreate

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

func (*AclContentLockFilter) PutObject

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

PutObject check locks before allowing Put operation.

func (*AclContentLockFilter) WrappedCanApply

func (a *AclContentLockFilter) WrappedCanApply(srcCtx context.Context, targetCtx context.Context, operation *tree.NodeChangeEvent) error

type AclFilterHandler

type AclFilterHandler struct {
	AbstractHandler
}

AclFilterHandler checks for read/write permissions depending on the call using the context AccessList.

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) MultipartCreate

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

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

func (*AclFilterHandler) WrappedCanApply

func (a *AclFilterHandler) WrappedCanApply(srcCtx context.Context, targetCtx context.Context, operation *tree.NodeChangeEvent) error

type AclLockFilter

type AclLockFilter struct {
	AbstractHandler
}

AclLockFilter filters call by checking internal locks.

func (*AclLockFilter) MultipartCreate

func (a *AclLockFilter) MultipartCreate(ctx context.Context, node *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.

func (*AclLockFilter) WrappedCanApply

func (a *AclLockFilter) WrappedCanApply(srcCtx context.Context, targetCtx context.Context, operation *tree.NodeChangeEvent) error

WrappedCanApply will perform checks on quota to make sure an operation is authorized

type AclQuotaFilter

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

AclQuotaFilter applies storage quota limitation on a per-workspace basis.

func (*AclQuotaFilter) ComputeQuota

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

ComputeQuota finds quota and current usage for a given workspace

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.

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.

func (*AclQuotaFilter) ReadNode

ReadNode append quota info on workspace roots

func (*AclQuotaFilter) WrappedCanApply

func (a *AclQuotaFilter) WrappedCanApply(srcCtx context.Context, targetCtx context.Context, operation *tree.NodeChangeEvent) error

WrappedCanApply will perform checks on quota to make sure an operation is authorized

type ArchiveHandler

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

ArchiveHandler dynamically create archives when downloading folders and supports archive contents listing.

func NewArchiveHandler added in v1.2.1

func NewArchiveHandler() *ArchiveHandler

NewArchiveHandler creates a new ArchiveHandler

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

ExtractAllTar extracts all files contained in a tar/tar.gz archive to a given location

func (*ArchiveReader) ExtractAllZip

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

ExtractAllZip extracts all files contained in a zip archive to a given location

func (*ArchiveReader) ListChildrenTar

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

ListChildrenTar extracts all children from a tar/tar.gz archive

func (*ArchiveReader) ListChildrenZip

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

ListChildrenZip extracts all children from a zip archive

func (*ArchiveReader) ReadChildTar

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

ReadChildTar reads content of a file contained in a tar/tar.gz archive

func (*ArchiveReader) ReadChildZip

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

ReadChildZip reads content of a file contained in a zip archive

func (*ArchiveReader) StatChildTar

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

StatChildTar finds information about a given entry of a tar/tar.gz archive (by its internal path)

func (*ArchiveReader) StatChildZip

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

StatChildZip finds information about a given entry of a zip archive (by its internal path)

type ArchiveWriter

type ArchiveWriter struct {
	Router Handler

	// Optional filter when listing nodes to build the archive
	WalkFilter WalkFilter
}

func (*ArchiveWriter) TarSelection

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

TarSelection creates a .tar or .tar.gz archive from nodes selection

func (*ArchiveWriter) ZipSelection

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

ZipSelection creates a .zip archive from nodes selection

type BinaryStoreHandler

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

BinaryStoreHandler captures put/get calls to an internal storage

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 map[string][]*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 ChangesWrappingStreamer

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

func NewChangesWrappingStreamer

func NewChangesWrappingStreamer() *ChangesWrappingStreamer

func (ChangesWrappingStreamer) Close

func (l ChangesWrappingStreamer) Close() error

func (*ChangesWrappingStreamer) Recv

func (ChangesWrappingStreamer) RecvMsg

func (l ChangesWrappingStreamer) RecvMsg(m interface{}) error

func (ChangesWrappingStreamer) Send

func (l ChangesWrappingStreamer) Send(in interface{}) error

func (ChangesWrappingStreamer) SendError

func (l ChangesWrappingStreamer) SendError(err error) error

func (ChangesWrappingStreamer) SendMsg

func (l ChangesWrappingStreamer) SendMsg(msg interface{}) error

type ClientsPool

type ClientsPool struct {
	// 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) *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)

GetDataSourceInfo tries to find information about a DataSource, eventually retrying as DataSource could be currently starting and not yet registered in the ClientsPool.

func (*ClientsPool) GetDataSources

func (p *ClientsPool) GetDataSources() map[string]LoadedSource

GetDataSources returns currently loaded datasources

func (*ClientsPool) GetTreeClient

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

GetTreeClient returns the internal NodeProviderClient pointing to the TreeService.

func (*ClientsPool) GetTreeClientWrite

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

GetTreeClientWrite returns the internal NodeReceiverClient pointing to the TreeService.

func (*ClientsPool) LoadDataSources

func (p *ClientsPool) LoadDataSources()

LoadDataSources queries the registry to reload available datasources

type ContextWrapper

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

type CopyRequestData

type CopyRequestData struct {
	Metadata     map[string]string
	SrcVersionId string
	Progress     io.Reader
}

These keys may be enriched in Context depending on the middleware

type CtxKeepAccessListKey added in v1.2.4

type CtxKeepAccessListKey struct{}

These keys may be enriched in Context depending on the middleware

type CtxUserAccessListKey added in v1.4.0

type CtxUserAccessListKey struct{}

These keys may be enriched in Context depending on the middleware

type EncryptionHandler

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

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 the 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 the datasource.

func (*EncryptionHandler) MultipartCreate added in v1.6.0

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

func (*EncryptionHandler) MultipartPutObjectPart added in v1.2.2

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

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.

func (*EncryptionHandler) SetNodeKeyManagerClient added in v1.5.0

func (e *EncryptionHandler) SetNodeKeyManagerClient(nodeKeyManagerClient encryption.NodeKeyManagerClient)

func (*EncryptionHandler) SetUserKeyTool added in v1.5.0

func (e *EncryptionHandler) SetUserKeyTool(keyTool key.UserKeyTool)

type Executor

type Executor struct {
	AbstractHandler
}

Executor is the final handler: it does not have a "next" handler, but actually performs all requests.

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

func (*Executor) WrappedCanApply

func (e *Executor) WrappedCanApply(_ context.Context, _ context.Context, _ *tree.NodeChangeEvent) error

type GetRequestData

type GetRequestData struct {
	StartOffset int64
	Length      int64
	VersionId   string
}

These keys may be enriched in Context depending on the middleware

type Handler

type Handler interface {
	tree.NodeProviderClient
	tree.NodeReceiverClient
	tree.NodeChangesStreamerClient
	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
	WrappedCanApply(srcCtx context.Context, targetCtx context.Context, operation *tree.NodeChangeEvent) error
	ListNodesWithCallback(ctx context.Context, request *tree.ListNodesRequest, callback WalkFunc, ignoreCbError bool, filters ...WalkFilter) error

	SetNextHandler(h Handler)
	SetClientsPool(p SourcesPool)
}

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
}

HandlerEventRead publishes events after reading files.

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 {
	RootDir string
	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) ListNodesWithCallback

func (h *HandlerMock) ListNodesWithCallback(ctx context.Context, request *tree.ListNodesRequest, callback WalkFunc, ignoreCbError bool, filters ...WalkFilter) error

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 SourcesPool)

func (*HandlerMock) SetNextHandler

func (h *HandlerMock) SetNextHandler(handler Handler)

func (*HandlerMock) UpdateNode

func (*HandlerMock) WrappedCanApply

func (h *HandlerMock) WrappedCanApply(srcCtx context.Context, targetCtx context.Context, operation *tree.NodeChangeEvent) error

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

func WithBucketName

func WithBucketName(s LoadedSource, bucket string) LoadedSource

WithBucketName creates a copy of a LoadedSource with a bucket name

func (LoadedSource) MarshalLogObject

func (s LoadedSource) MarshalLogObject(encoder zapcore.ObjectEncoder) error

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
}

MultipleRootsHandler handle special case of multiple-roots workspaces.

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 NodeWrappingStreamer

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

NodeWrappingStreamer wraps an existing Node Streamer.

func NewWrappingStreamer

func NewWrappingStreamer() *NodeWrappingStreamer

func (NodeWrappingStreamer) Close

func (l NodeWrappingStreamer) Close() error

func (*NodeWrappingStreamer) Recv

func (NodeWrappingStreamer) RecvMsg

func (l NodeWrappingStreamer) RecvMsg(m interface{}) error

func (NodeWrappingStreamer) Send

func (l NodeWrappingStreamer) Send(in interface{}) error

func (NodeWrappingStreamer) SendError

func (l NodeWrappingStreamer) SendError(err error) error

func (NodeWrappingStreamer) SendMsg

func (l NodeWrappingStreamer) SendMsg(msg interface{}) error

type NodesCallback

type NodesCallback func(inputFilter NodeFilter, outputFilter NodeFilter) error

type PathDataSourceHandler

type PathDataSourceHandler struct {
	AbstractBranchFilter
}

PathDataSourceHandler is an AbstractBranchFilter adding/extracting datasource name from the path.

func NewPathDataSourceHandler

func NewPathDataSourceHandler() *PathDataSourceHandler

type PathWorkspaceHandler

type PathWorkspaceHandler struct {
	AbstractBranchFilter
}

PathWorkspaceHandler is an AbstractBranchFilter extracting workspace and managing path inside the workspace.

func NewPathWorkspaceHandler

func NewPathWorkspaceHandler() *PathWorkspaceHandler

func (*PathWorkspaceHandler) ListNodes

func (*PathWorkspaceHandler) ReadNode

type PutHandler

type PutHandler struct {
	AbstractHandler
}

PutHandler handles Put requests by creating temporary files in the index before forwarding data to the object service. This temporary entry is updated later on by the sync service, once the object is written. It is deleted if the Put operation fails.

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) MultipartAbort added in v1.2.2

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

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
	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 SourcesPool, 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) CanApply

func (v *Router) CanApply(ctx context.Context, operation *tree.NodeChangeEvent) (*tree.NodeChangeEvent, error)

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() SourcesPool

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) ListNodesWithCallback

func (v *Router) ListNodesWithCallback(ctx context.Context, request *tree.ListNodesRequest, callback WalkFunc, ignoreCbError bool, filters ...WalkFilter) error

ListNodesWithCallback performs a ListNodes request and applied callback with optional filters. This hides the complexity of streams handling.

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(SourcesPool)

func (*Router) SetNextHandler

func (v *Router) SetNextHandler(Handler)

To respect Handler interface

func (*Router) UpdateNode

func (*Router) WrapCallback

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

func (*Router) WrappedCanApply

func (v *Router) WrappedCanApply(srcCtx context.Context, targetCtx context.Context, operation *tree.NodeChangeEvent) error

type RouterEventFilter

type RouterEventFilter struct {
	Router
	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, accessList *permissions.AccessList, workspace *idm.Workspace, node *tree.Node) (*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
	SynchronousCache bool
	SynchronousTasks bool
}

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

type SourcesPool

type SourcesPool interface {
	Close()
	GetTreeClient() tree.NodeProviderClient
	GetTreeClientWrite() tree.NodeReceiverClient
	GetDataSourceInfo(dsName string, retries ...int) (LoadedSource, error)
	GetDataSources() map[string]LoadedSource
	LoadDataSources()
}

These keys may be enriched in Context depending on the middleware

type SyncFolderTasksHandler

type SyncFolderTasksHandler struct {
	AbstractHandler
}

SyncFolderTasksHandler is a handler implementing synchronous operations for moving or deleting folders

func (*SyncFolderTasksHandler) DeleteNode

DeleteNode synchronously and recursively delete a node

func (*SyncFolderTasksHandler) UpdateNode

UpdateNode synchronously and recursively performs a Move operation of a node

type SynchronousCacheHandler added in v1.5.0

type SynchronousCacheHandler struct {
	AbstractHandler
}

SynchronousCacheHandler maintains a cache of the nodes during modifying operations to make listings more reactive. It is used by basic APIs (like WebDAV) for better visual performances and to create pseudo-synchronous APIs.

func NewSynchronousCacheHandler added in v1.5.0

func NewSynchronousCacheHandler() *SynchronousCacheHandler

func (*SynchronousCacheHandler) CreateNode added in v1.5.0

func (*SynchronousCacheHandler) DeleteNode added in v1.5.0

func (*SynchronousCacheHandler) ListNodes added in v1.5.0

func (*SynchronousCacheHandler) MultipartComplete added in v1.5.0

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

func (*SynchronousCacheHandler) PutObject added in v1.5.0

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

func (*SynchronousCacheHandler) ReadNode added in v1.5.0

func (*SynchronousCacheHandler) UpdateNode added in v1.5.0

type UploadLimitFilter

type UploadLimitFilter struct {
	AbstractHandler
}

UploadLimitFilter restricts atomic uploads by extension and maximum size, based on the front plugins configuration.

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
}

UuidDataSourceHandler is an AbstractBranchFilter extracting datasource info based on node UUID.

func NewUuidDataSourceHandler

func NewUuidDataSourceHandler() *UuidDataSourceHandler

type UuidNodeHandler

type UuidNodeHandler struct {
	AbstractBranchFilter
}

UuidNodeHandler is an AbstractBranchFilter extracting workspace info based on node UUID.

func NewUuidNodeHandler

func NewUuidNodeHandler() *UuidNodeHandler

type VersionHandler

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

VersionHandler capture ListNodes and GetObject calls to find existing nodes versions and retrieve them.

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
}

VirtualNodesBrowser is used by admin mode to list virtual nodes instead of their resolved values.

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 {
	// contains filtered or unexported fields
}

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) GetResolver

func (m *VirtualNodesManager) GetResolver(pool SourcesPool, createIfNotExists bool) func(context.Context, *tree.Node) (*tree.Node, bool)

GetResolver injects some dependencies to generate a simple resolver function

func (*VirtualNodesManager) ListNodes

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

ListNodes simply returns the internally cached list.

func (*VirtualNodesManager) Load

func (m *VirtualNodesManager) Load(forceReload ...bool)

Load requests the virtual nodes from the DocStore service.

func (*VirtualNodesManager) ResolveInContext

func (m *VirtualNodesManager) ResolveInContext(ctx context.Context, vNode *tree.Node, clientsPool SourcesPool, create bool, retry ...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
}

VirtualNodesResolver dynamically resolves virtual nodes to their runtime value.

func NewVirtualNodesHandler

func NewVirtualNodesHandler() *VirtualNodesResolver

type WalkFilter

type WalkFilter func(ctx context.Context, node *tree.Node) bool

type WalkFunc

type WalkFunc func(ctx context.Context, node *tree.Node, err error) error

type WorkspaceRootResolver

type WorkspaceRootResolver struct {
	AbstractBranchFilter
}

WorkspaceRootResolver is an AbstractBranchFilter finding workspace root(s) based on the path.

func NewWorkspaceRootResolver

func NewWorkspaceRootResolver() *WorkspaceRootResolver

Jump to

Keyboard shortcuts

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