cells

package
v3.0.3+incompatible Latest Latest
Warning

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

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

Documentation

Overview

Package cells provides endpoints for speaking either with a local server using a views.Router (and connecting to the local NATS registry), or a remote Cells server using a GRPC gateway client.

Index

Constants

This section is empty.

Variables

View Source
var (
	RemoteCellsServiceName = "pydio.gateway.grpc"
)

Functions

This section is empty.

Types

type Abstract

type Abstract struct {
	sync.Mutex
	Factory clientProviderFactory
	Source  model.PathSyncSource

	ClientUUID   string
	Root         string
	Options      Options
	RecentMkDirs []*tree.Node
	GlobalCtx    context.Context
	// contains filtered or unexported fields
}

func (*Abstract) ComputeChecksum

func (c *Abstract) ComputeChecksum(node *tree.Node) error

ComputeChecksum is not implemented

func (*Abstract) CreateNode

func (c *Abstract) CreateNode(ctx context.Context, node *tree.Node, updateIfExists bool) (err error)

CreateNode is used for creating folders only

func (*Abstract) DeleteNode

func (c *Abstract) DeleteNode(ctx context.Context, name string) (err error)

DeleteNode forwards call to the grpc gateway. For folders, the recursive deletion will happen on the gateway side. It may take some time, thus a request timeout of 5 minutes.

func (*Abstract) GetCachedBranches

func (c *Abstract) GetCachedBranches(ctx context.Context, roots ...string) model.PathSyncSource

GetCachedBranches implements CachedBranchProvider by loading branches in a MemDB

func (*Abstract) GetReaderOn

func (c *Abstract) GetReaderOn(p string) (out io.ReadCloser, err error)

GetReaderOn retrieves an io.ReadCloser from the S3 Get operation

func (*Abstract) GetWriterOn

func (c *Abstract) GetWriterOn(cancel context.Context, p string, targetSize int64) (out io.WriteCloser, writeDone chan bool, writeErr chan error, err error)

GetWriterOn retrieves a WriteCloser wired to the S3 gateway to PUT a file.

func (*Abstract) LoadNode

func (c *Abstract) LoadNode(ctx context.Context, path string, extendedStats ...bool) (node *tree.Node, err error)

LoadNode forwards call to cli.ReadNode

func (*Abstract) MoveNode

func (c *Abstract) MoveNode(ct context.Context, oldPath string, newPath string) (err error)

MoveNode renames a file or folder and *blocks* until the node has been properly moved (sync)

func (*Abstract) PatchUpdateSnapshot

func (c *Abstract) PatchUpdateSnapshot(ctx context.Context, patch interface{})

PatchUpdateSnapshot does nothing

func (*Abstract) SetUpdateSnapshot

func (c *Abstract) SetUpdateSnapshot(target model.PathSyncTarget)

SetUpdateSnapshot registers a snapshot to be updated when events are received from server

func (*Abstract) Walk

func (c *Abstract) Walk(walknFc model.WalkNodesFunc, root string, recursive bool) (err error)

Walk uses cli.ListNodes() to browse nodes starting from a root (recursively or not). Temporary nodes are ignored. Workspaces nodes are ignored if they don't have the WorkspaceSyncable flag in their Metadata

func (*Abstract) Watch

func (c *Abstract) Watch(recursivePath string) (*model.WatchObject, error)

Watch uses a GRPC connection to listen to events from the Grpc Gateway (wired to the the Tree Service via a Router).

type DynamicRegistry

type DynamicRegistry struct {
	Micro registry.Registry
	// contains filtered or unexported fields
}

DynamicRegistry is an implementation of a Micro Registry that automatically detect the target GRPC port from the discovery endpoint of the target server.

func NewDynamicRegistry

func NewDynamicRegistry(config *transport.SdkConfig) *DynamicRegistry

NewDynamicRegistry creates a new DynamicRegistry from a standard SdkConfig

func (*DynamicRegistry) Refresh

func (d *DynamicRegistry) Refresh() error

Refresh deregisters all services and tries to detect service

type NoopWriter

type NoopWriter struct{}

NoopWriter is a simple writer for ignoring contents

func (*NoopWriter) Close

func (nw *NoopWriter) Close() error

func (*NoopWriter) Write

func (nw *NoopWriter) Write(p []byte) (n int, err error)

type ObjectsClient

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

type Options

type Options struct {
	model.EndpointOptions
	// If router is started in an independent process, call basic initialization to connect to registry.
	LocalInitRegistry bool
	// If a sync is connecting two endpoint of a same server, we have to make sure to avoid Uuid collision
	RenewFolderUuids bool
}

type RegistryRefreshClient

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

RegistryRefreshClient is an implementation of a Micro Client that tries to refresh the registry if a streamer connection is broken (GRPC port may change across server restart).

func (*RegistryRefreshClient) Call

func (r *RegistryRefreshClient) Call(ctx context.Context, req client.Request, rsp interface{}, opts ...client.CallOption) error

func (*RegistryRefreshClient) CallRemote

func (r *RegistryRefreshClient) CallRemote(ctx context.Context, addr string, req client.Request, rsp interface{}, opts ...client.CallOption) error

func (*RegistryRefreshClient) Init

func (r *RegistryRefreshClient) Init(o ...client.Option) error

func (*RegistryRefreshClient) NewJsonRequest

func (r *RegistryRefreshClient) NewJsonRequest(service, method string, req interface{}, reqOpts ...client.RequestOption) client.Request

func (*RegistryRefreshClient) NewProtoRequest

func (r *RegistryRefreshClient) NewProtoRequest(service, method string, req interface{}, reqOpts ...client.RequestOption) client.Request

func (*RegistryRefreshClient) NewPublication

func (r *RegistryRefreshClient) NewPublication(topic string, msg interface{}) client.Publication

func (*RegistryRefreshClient) NewRequest

func (r *RegistryRefreshClient) NewRequest(service, method string, req interface{}, reqOpts ...client.RequestOption) client.Request

func (*RegistryRefreshClient) Options

func (r *RegistryRefreshClient) Options() client.Options

func (*RegistryRefreshClient) Publish

func (*RegistryRefreshClient) Stream

func (*RegistryRefreshClient) StreamRemote

func (r *RegistryRefreshClient) StreamRemote(ctx context.Context, addr string, req client.Request, opts ...client.CallOption) (client.Streamer, error)

func (*RegistryRefreshClient) String

func (r *RegistryRefreshClient) String() string

type Remote

type Remote struct {
	Abstract
	// contains filtered or unexported fields
}

Remote connect to a remove Cells server using the GRPC gateway.

func NewRemote

func NewRemote(config RemoteConfig, root string, options Options) *Remote

NewRemote creates a new Remote Endpoint

func (*Remote) BulkLoadNodes

func (c *Remote) BulkLoadNodes(ctx context.Context, nodes map[string]string) (map[string]interface{}, error)

BulkLoadNodes streams ReadNode requests from server

func (*Remote) CreateNode

func (c *Remote) CreateNode(ctx context.Context, node *tree.Node, updateIfExists bool) (err error)

CreateNode creates folder, eventually resetting their UUID if the options RenewFolderUuids is set. If an indexation session is started, it stacks all Creates in memory and perform them only at Flush.

func (*Remote) FinishSession

func (c *Remote) FinishSession(ctx context.Context, sessionUuid string) error

FinishSession flushes the session and closes it.

func (*Remote) FlushSession

func (c *Remote) FlushSession(ctx context.Context, sessionUuid string) error

FlushSession sends all creates as a stream to the target server

func (*Remote) GetEndpointInfo

func (c *Remote) GetEndpointInfo() model.EndpointInfo

GetEndpointInfo returns Endpoint information in standard format.

func (*Remote) RefreshRemoteConfig

func (c *Remote) RefreshRemoteConfig(config RemoteConfig)

RefreshRemoteConfig is used to refresh ID Token / Refresh Token from outside

func (*Remote) StartSession

func (c *Remote) StartSession(ctx context.Context, rootNode *tree.Node, silent bool) (*tree.IndexationSession, error)

StartSession starts an indexation session.

type RemoteConfig

type RemoteConfig struct {
	// Url stores domain name or IP & port to the server.
	Url string `json:"url"`
	// OIDC GrantPassword Flow
	ClientKey    string `json:"clientKey"`
	ClientSecret string `json:"clientSecret"`
	User         string `json:"user"`
	Password     string `json:"password"`
	// OIDC Code Flow
	IdToken      string `json:"id_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresAt    int    `json:"expires_at"`
	// SkipVerify tells the transport to ignore expired or self-signed TLS certificates
	SkipVerify    bool              `json:"skipVerify"`
	CustomHeaders map[string]string `json:"-"`
}

RemoteConfig is a dependency-free struct similar to SdkConfig

Directories

Path Synopsis
Package cells_sdk provides a ready to use SDK to use the Cells REST API in Go language.
Package cells_sdk provides a ready to use SDK to use the Cells REST API in Go language.
mc

Jump to

Keyboard shortcuts

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