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 ¶
- type Abstract
- func (c *Abstract) ComputeChecksum(ctx context.Context, node tree.N) error
- func (c *Abstract) CreateNode(ctx context.Context, node tree.N, updateIfExists bool) (err error)
- func (c *Abstract) DeleteNode(ctx context.Context, name string) (err error)
- func (c *Abstract) GetCachedBranches(ctx context.Context, roots ...string) (model.PathSyncSource, error)
- func (c *Abstract) GetReaderOn(ctx context.Context, p string) (out io.ReadCloser, err error)
- func (c *Abstract) GetWriterOn(cancel context.Context, p string, targetSize int64) (out io.WriteCloser, writeDone chan bool, writeErr chan error, err error)
- func (c *Abstract) LoadNode(ctx context.Context, path string, extendedStats ...bool) (node tree.N, err error)
- func (c *Abstract) MoveNode(ct context.Context, oldPath string, newPath string) (err error)
- func (c *Abstract) PatchUpdateSnapshot(ctx context.Context, patch interface{})
- func (c *Abstract) SetUpdateSnapshot(target model.PathSyncTarget)
- func (c *Abstract) Walk(ctx context.Context, walkFunc model.WalkNodesFunc, root string, recursive bool) (err error)
- func (c *Abstract) Watch(recursivePath string) (*model.WatchObject, error)
- type NoopWriter
- type ObjectsClient
- type Options
- type Remote
- func (c *Remote) BulkLoadNodes(ctx context.Context, nodes map[string]string) (map[string]interface{}, error)
- func (c *Remote) CreateNode(ctx context.Context, node tree.N, updateIfExists bool) (err error)
- func (c *Remote) FinishSession(ctx context.Context, sessionUuid string) error
- func (c *Remote) FlushSession(ctx context.Context, sessionUuid string) error
- func (c *Remote) GetEndpointInfo() model.EndpointInfo
- func (c *Remote) RefreshRemoteConfig(config RemoteConfig)
- func (c *Remote) StartSession(ctx context.Context, rootNode tree.N, silent bool) (string, error)
- type RemoteConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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.N GlobalCtx context.Context // contains filtered or unexported fields }
func (*Abstract) ComputeChecksum ¶
ComputeChecksum is not implemented
func (*Abstract) CreateNode ¶
CreateNode is used for creating folders only
func (*Abstract) DeleteNode ¶
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, error)
GetCachedBranches implements CachedBranchProvider by loading branches in a MemDB
func (*Abstract) GetReaderOn ¶
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.N, err error)
LoadNode forwards call to cli.ReadNode
func (*Abstract) MoveNode ¶
MoveNode renames a file or folder and *blocks* until the node has been properly moved (sync)
func (*Abstract) PatchUpdateSnapshot ¶
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(ctx context.Context, walkFunc 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
type NoopWriter ¶
type NoopWriter struct{}
NoopWriter is a simple writer for ignoring contents
func (*NoopWriter) Close ¶
func (nw *NoopWriter) Close() 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) (models.ObjectInfo, error) CopyObject(ctx context.Context, from *tree.Node, to *tree.Node, requestData *models.CopyRequestData) (models.ObjectInfo, 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 // When starting endpoint within a known runtime, set runtime context (e.g. scheduler task) LocalRuntimeContext context.Context // If a sync is connecting two endpoint of a same server, we have to make sure to avoid Uuid collision RenewFolderUuids bool }
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 ¶
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 ¶
FinishSession flushes the session and closes it.
func (*Remote) FlushSession ¶
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
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