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.
Copyright (c) 2019. Abstrium SAS <team (at) pydio.com>
This file is part of Pydio Cells. *
Pydio Cells is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. *
Pydio Cells is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details. *
You should have received a copy of the GNU Affero General Public License
along with Pydio Cells. If not, see <http://www.gnu.org/licenses/>. *
The latest code can be found at <https://pydio.com>.
Copyright (c) 2019. Abstrium SAS <team (at) pydio.com>
This file is part of Pydio Cells. *
Pydio Cells is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. *
Pydio Cells is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details. *
You should have received a copy of the GNU Affero General Public License
along with Pydio Cells. If not, see <http://www.gnu.org/licenses/>. *
The latest code can be found at <https://pydio.com>.
Index ¶
- Variables
- type DynamicRegistry
- type Local
- func (c *Local) ComputeChecksum(node *tree.Node) error
- func (c *Local) CreateNode(ctx context.Context, node *tree.Node, updateIfExists bool) (err error)
- func (c *Local) DeleteNode(ctx context.Context, name string) (err error)
- func (c *Local) GetCachedBranches(ctx context.Context, roots ...string) model.PathSyncSource
- func (l *Local) GetEndpointInfo() model.EndpointInfo
- func (c *Local) GetReaderOn(p string) (out io.ReadCloser, err error)
- func (c *Local) GetWriterOn(cancel context.Context, p string, targetSize int64) (out io.WriteCloser, writeDone chan bool, writeErr chan error, err error)
- func (c *Local) LoadNode(ctx context.Context, path string, extendedStats ...bool) (node *tree.Node, err error)
- func (c *Local) MoveNode(ct context.Context, oldPath string, newPath string) (err error)
- func (c *Local) PatchUpdateSnapshot(ctx context.Context, patch interface{})
- func (c *Local) SetUpdateSnapshot(target model.PathSyncTarget)
- func (c *Local) Walk(walknFc model.WalkNodesFunc, root string, recursive bool) (err error)
- func (c *Local) Watch(recursivePath string) (*model.WatchObject, error)
- type NoopWriter
- type Options
- type RegistryRefreshClient
- func (r *RegistryRefreshClient) Call(ctx context.Context, req client.Request, rsp interface{}, ...) error
- func (r *RegistryRefreshClient) CallRemote(ctx context.Context, addr string, req client.Request, rsp interface{}, ...) error
- func (r *RegistryRefreshClient) Init(o ...client.Option) error
- func (r *RegistryRefreshClient) NewJsonRequest(service, method string, req interface{}, reqOpts ...client.RequestOption) client.Request
- func (r *RegistryRefreshClient) NewProtoRequest(service, method string, req interface{}, reqOpts ...client.RequestOption) client.Request
- func (r *RegistryRefreshClient) NewPublication(topic string, msg interface{}) client.Publication
- func (r *RegistryRefreshClient) NewRequest(service, method string, req interface{}, reqOpts ...client.RequestOption) client.Request
- func (r *RegistryRefreshClient) Options() client.Options
- func (r *RegistryRefreshClient) Publish(ctx context.Context, p client.Publication, opts ...client.PublishOption) error
- func (r *RegistryRefreshClient) Stream(ctx context.Context, req client.Request, opts ...client.CallOption) (client.Streamer, error)
- func (r *RegistryRefreshClient) StreamRemote(ctx context.Context, addr string, req client.Request, ...) (client.Streamer, error)
- func (r *RegistryRefreshClient) String() string
- type Remote
- func (c *Remote) BulkLoadNodes(ctx context.Context, nodes map[string]string) (map[string]interface{}, error)
- func (c *Remote) ComputeChecksum(node *tree.Node) error
- func (c *Remote) CreateNode(ctx context.Context, node *tree.Node, updateIfExists bool) (err error)
- func (c *Remote) DeleteNode(ctx context.Context, name string) (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) GetCachedBranches(ctx context.Context, roots ...string) model.PathSyncSource
- func (c *Remote) GetEndpointInfo() model.EndpointInfo
- func (c *Remote) GetReaderOn(p string) (out io.ReadCloser, err error)
- func (c *Remote) GetWriterOn(cancel context.Context, p string, targetSize int64) (out io.WriteCloser, writeDone chan bool, writeErr chan error, err error)
- func (c *Remote) LoadNode(ctx context.Context, path string, extendedStats ...bool) (node *tree.Node, err error)
- func (c *Remote) MoveNode(ct context.Context, oldPath string, newPath string) (err error)
- func (c *Remote) PatchUpdateSnapshot(ctx context.Context, patch interface{})
- func (c *Remote) RefreshRemoteConfig(config RemoteConfig)
- func (c *Remote) SetUpdateSnapshot(target model.PathSyncTarget)
- func (c *Remote) StartSession(ctx context.Context, rootNode *tree.Node, silent bool) (*tree.IndexationSession, error)
- func (c *Remote) Walk(walknFc model.WalkNodesFunc, root string, recursive bool) (err error)
- func (c *Remote) Watch(recursivePath string) (*model.WatchObject, error)
- type RemoteConfig
Constants ¶
This section is empty.
Variables ¶
var (
RemoteCellsServiceName = "pydio.gateway.grpc"
)
Functions ¶
This section is empty.
Types ¶
type DynamicRegistry ¶
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 *sdk.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 Local ¶
type Local struct {
// contains filtered or unexported fields
}
Local directly connects to a Cells server running in the same network, by connecting to the local NATS registry
func (*Local) ComputeChecksum ¶
ComputeChecksum is not implemented
func (*Local) CreateNode ¶
CreateNode is used for creating folders only
func (*Local) 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 (*Local) GetCachedBranches ¶
func (c *Local) GetCachedBranches(ctx context.Context, roots ...string) model.PathSyncSource
GetCachedBranches implements CachedBranchProvider by loading branches in a MemDB
func (*Local) GetEndpointInfo ¶
func (l *Local) GetEndpointInfo() model.EndpointInfo
GetEndpointInfo returns info about this endpoint
func (*Local) GetReaderOn ¶
func (c *Local) GetReaderOn(p string) (out io.ReadCloser, err error)
GetReaderOn retrieves an io.ReadCloser from the S3 Get operation
func (*Local) GetWriterOn ¶
func (c *Local) GetWriterOn(cancel context.Context, p string, targetSize int64) (out io.WriteCloser, writeDone chan bool, writeErr chan error, err error)
GetWriteOn retrieves a WriteCloser wired to the S3 gateway to PUT a file.
func (*Local) LoadNode ¶
func (c *Local) LoadNode(ctx context.Context, path string, extendedStats ...bool) (node *tree.Node, err error)
LoadNode forwards call to cli.ReadNode
func (*Local) MoveNode ¶
MoveNode renames a file or folder and *blocks* until the node has been properly moved (sync)
func (*Local) PatchUpdateSnapshot ¶
PatchUpdateSnapshot does nothing
func (*Local) SetUpdateSnapshot ¶
func (c *Local) SetUpdateSnapshot(target model.PathSyncTarget)
SetUpdateSnapshot registers a snapshot to be updated when events are received from server
func (*Local) Walk ¶
func (c *Local) 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
type NoopWriter ¶
type NoopWriter struct{}
NoopWriter is a simple writer for ignoring contents
func (*NoopWriter) Close ¶
func (nw *NoopWriter) Close() 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 accross 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) 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 (r *RegistryRefreshClient) Publish(ctx context.Context, p client.Publication, opts ...client.PublishOption) error
func (*RegistryRefreshClient) Stream ¶
func (r *RegistryRefreshClient) Stream(ctx context.Context, req client.Request, opts ...client.CallOption) (client.Streamer, error)
func (*RegistryRefreshClient) StreamRemote ¶
func (*RegistryRefreshClient) String ¶
func (r *RegistryRefreshClient) String() string
type Remote ¶
type Remote struct {
// 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) ComputeChecksum ¶
ComputeChecksum is not implemented
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) 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 (*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) GetCachedBranches ¶
func (c *Remote) GetCachedBranches(ctx context.Context, roots ...string) model.PathSyncSource
GetCachedBranches implements CachedBranchProvider by loading branches in a MemDB
func (*Remote) GetEndpointInfo ¶
func (c *Remote) GetEndpointInfo() model.EndpointInfo
GetEndpointInfo returns Endpoint information in standard format.
func (*Remote) GetReaderOn ¶
func (c *Remote) GetReaderOn(p string) (out io.ReadCloser, err error)
GetReaderOn retrieves an io.ReadCloser from the S3 Get operation
func (*Remote) GetWriterOn ¶
func (c *Remote) GetWriterOn(cancel context.Context, p string, targetSize int64) (out io.WriteCloser, writeDone chan bool, writeErr chan error, err error)
GetWriteOn retrieves a WriteCloser wired to the S3 gateway to PUT a file.
func (*Remote) LoadNode ¶
func (c *Remote) LoadNode(ctx context.Context, path string, extendedStats ...bool) (node *tree.Node, err error)
LoadNode forwards call to cli.ReadNode
func (*Remote) MoveNode ¶
MoveNode renames a file or folder and *blocks* until the node has been properly moved (sync)
func (*Remote) PatchUpdateSnapshot ¶
PatchUpdateSnapshot does nothing
func (*Remote) RefreshRemoteConfig ¶
func (c *Remote) RefreshRemoteConfig(config RemoteConfig)
RefreshRemoteConfig is used to refresh ID Token / Refresh Token from outside
func (*Remote) SetUpdateSnapshot ¶
func (c *Remote) SetUpdateSnapshot(target model.PathSyncTarget)
SetUpdateSnapshot registers a snapshot to be updated when events are received from server
func (*Remote) StartSession ¶
func (c *Remote) StartSession(ctx context.Context, rootNode *tree.Node, silent bool) (*tree.IndexationSession, error)
StartSession starts an indexation session.
func (*Remote) Walk ¶
func (c *Remote) 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
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