Documentation
¶
Overview ¶
Package service hosts the registry-backed peer resolver embedded by every reva service across all transports. It is neutral (imports only CS3 client types and the registry) to avoid an import cycle.
Index ¶
- Constants
- func AppAuthProvider(ctx context.Context) (applicationauth.ApplicationsAPIClient, error)
- func AppProvider(ctx context.Context) (appprovider.ProviderAPIClient, error)
- func AppProviderAt(address string) (appprovider.ProviderAPIClient, error)
- func AppRegistry(ctx context.Context) (appregistry.RegistryAPIClient, error)
- func AuthProvider(ctx context.Context) (authprovider.ProviderAPIClient, error)
- func AuthProviderAt(address string) (authprovider.ProviderAPIClient, error)
- func AuthRegistry(ctx context.Context) (authregistry.RegistryAPIClient, error)
- func DataTx(ctx context.Context) (datatx.TxAPIClient, error)
- func Degrade(service, address string)
- func Gateway(ctx context.Context) (gateway.GatewayAPIClient, error)
- func GatewayAt(address string) (gateway.GatewayAPIClient, error)
- func GlobalRegistry() registry.Registry
- func GroupProvider(ctx context.Context) (group.GroupAPIClient, error)
- func Labels(ctx context.Context) (labels.LabelsAPIClient, error)
- func OCMIncoming(ctx context.Context) (ocmincoming.OcmIncomingAPIClient, error)
- func OCMInviteManager(ctx context.Context) (invitepb.InviteAPIClient, error)
- func OCMProviderAuthorizer(ctx context.Context) (ocmprovider.ProviderAPIClient, error)
- func OCMShareProvider(ctx context.Context) (ocm.OcmAPIClient, error)
- func Permissions(ctx context.Context) (permissions.PermissionsAPIClient, error)
- func Preferences(ctx context.Context) (preferences.PreferencesAPIClient, error)
- func PublicShareProvider(ctx context.Context) (link.LinkAPIClient, error)
- func SetClientAt(address string, client any)
- func SetGlobal(c Clients)
- func SetGlobalRegistry(r registry.Registry)
- func Spaces(ctx context.Context) (storageprovider.SpacesAPIClient, error)
- func StorageProvider(ctx context.Context) (storageprovider.ProviderAPIClient, error)
- func StorageProviderAt(address string) (storageprovider.ProviderAPIClient, error)
- func StorageRegistry(ctx context.Context) (storageregistry.RegistryAPIClient, error)
- func StorageRegistryAt(address string) (storageregistry.RegistryAPIClient, error)
- func UserProvider(ctx context.Context) (user.UserAPIClient, error)
- func UserProviderAt(address string) (user.UserAPIClient, error)
- func UserShareProvider(ctx context.Context) (collaboration.CollaborationAPIClient, error)
- type Clients
- type Endpoint
- type EndpointOption
- type FirstSelector
- type MetadataProvider
- type RandomSelector
- type RoundRobinSelector
- type Selector
Constants ¶
const ( NameGateway = "gateway" NameStorageProvider = "storageprovider" NameStorageRegistry = "storageregistry" NameAuthProvider = "authprovider" NameAuthRegistry = "authregistry" NameAppAuthProvider = "applicationauth" NameUserProvider = "userprovider" NameGroupProvider = "groupprovider" NameOCMInvite = "ocminvitemanager" NameOCMProvider = "ocmproviderauthorizer" NameOCMIncoming = "ocmincoming" NamePreferences = "preferences" NamePermissions = "permissions" NameAppRegistry = "appregistry" NameAppProvider = "appprovider" NameSpaces = "spacesregistry" NameDataTx = "datatx" NameLabels = "labelsprovider" NameAdmin = "admin" // NameControl labels the per-process control channel on its internal // server; it is discovered via node metadata, not registered as a service. NameControl = "control" )
Service names processes register under and the resolver looks up.
Variables ¶
This section is empty.
Functions ¶
func AppAuthProvider ¶
func AppAuthProvider(ctx context.Context) (applicationauth.ApplicationsAPIClient, error)
AppAuthProvider resolves the application auth provider through the global resolver.
func AppProvider ¶
func AppProvider(ctx context.Context) (appprovider.ProviderAPIClient, error)
AppProvider resolves the app provider through the global resolver.
func AppProviderAt ¶
func AppProviderAt(address string) (appprovider.ProviderAPIClient, error)
AppProviderAt returns an app provider client for an explicit address.
func AppRegistry ¶
func AppRegistry(ctx context.Context) (appregistry.RegistryAPIClient, error)
AppRegistry resolves the app registry through the global resolver.
func AuthProvider ¶
func AuthProvider(ctx context.Context) (authprovider.ProviderAPIClient, error)
AuthProvider resolves the auth provider through the global resolver.
func AuthProviderAt ¶
func AuthProviderAt(address string) (authprovider.ProviderAPIClient, error)
AuthProviderAt returns an auth provider client for an explicit address.
func AuthRegistry ¶
func AuthRegistry(ctx context.Context) (authregistry.RegistryAPIClient, error)
AuthRegistry resolves the auth registry through the global resolver.
func DataTx ¶
func DataTx(ctx context.Context) (datatx.TxAPIClient, error)
DataTx resolves the data transfer service through the global resolver.
func Degrade ¶
func Degrade(service, address string)
Degrade marks the node at address degraded on the global resolver.
func Gateway ¶
func Gateway(ctx context.Context) (gateway.GatewayAPIClient, error)
Gateway resolves the gateway through the global resolver.
func GatewayAt ¶
func GatewayAt(address string) (gateway.GatewayAPIClient, error)
GatewayAt returns a gateway client for an explicit address.
func GlobalRegistry ¶
GlobalRegistry returns the process-wide registry, or nil if none was set.
func GroupProvider ¶
func GroupProvider(ctx context.Context) (group.GroupAPIClient, error)
GroupProvider resolves the group provider through the global resolver.
func Labels ¶
func Labels(ctx context.Context) (labels.LabelsAPIClient, error)
Labels resolves the labels service through the global resolver.
func OCMIncoming ¶
func OCMIncoming(ctx context.Context) (ocmincoming.OcmIncomingAPIClient, error)
OCMIncoming resolves the OCM incoming service through the global resolver.
func OCMInviteManager ¶
func OCMInviteManager(ctx context.Context) (invitepb.InviteAPIClient, error)
OCMInviteManager resolves the OCM invite manager through the global resolver.
func OCMProviderAuthorizer ¶
func OCMProviderAuthorizer(ctx context.Context) (ocmprovider.ProviderAPIClient, error)
OCMProviderAuthorizer resolves the OCM provider authorizer through the global resolver.
func OCMShareProvider ¶
func OCMShareProvider(ctx context.Context) (ocm.OcmAPIClient, error)
OCMShareProvider resolves the OCM share provider through the global resolver.
func Permissions ¶
func Permissions(ctx context.Context) (permissions.PermissionsAPIClient, error)
Permissions resolves the permissions service through the global resolver.
func Preferences ¶
func Preferences(ctx context.Context) (preferences.PreferencesAPIClient, error)
Preferences resolves the preferences service through the global resolver.
func PublicShareProvider ¶
func PublicShareProvider(ctx context.Context) (link.LinkAPIClient, error)
PublicShareProvider resolves the public share provider through the global resolver.
func SetClientAt ¶
SetClientAt pins client to address, so the *At getters below return it rather than dialing. It exists for tests: a fake peer has no listener to dial, but the code under test still reaches it by the address a registry lookup handed back. Pass a nil client to drop the pin.
func SetGlobal ¶
func SetGlobal(c Clients)
SetGlobal installs the process-wide peer resolver. The first non-nil resolver wins; later calls are ignored. The runtime sets it once at startup so any component can resolve peers without being explicitly wired.
func SetGlobalRegistry ¶
SetGlobalRegistry installs the process-wide service registry handle. The first non-nil registry wins; later calls are ignored.
func Spaces ¶
func Spaces(ctx context.Context) (storageprovider.SpacesAPIClient, error)
Spaces resolves the spaces registry through the global resolver.
func StorageProvider ¶
func StorageProvider(ctx context.Context) (storageprovider.ProviderAPIClient, error)
StorageProvider resolves the storage provider through the global resolver.
func StorageProviderAt ¶
func StorageProviderAt(address string) (storageprovider.ProviderAPIClient, error)
StorageProviderAt returns a storage provider client for an explicit address.
func StorageRegistry ¶
func StorageRegistry(ctx context.Context) (storageregistry.RegistryAPIClient, error)
StorageRegistry resolves the storage registry through the global resolver.
func StorageRegistryAt ¶
func StorageRegistryAt(address string) (storageregistry.RegistryAPIClient, error)
StorageRegistryAt returns a storage registry client for an explicit address.
func UserProvider ¶
func UserProvider(ctx context.Context) (user.UserAPIClient, error)
UserProvider resolves the user provider through the global resolver.
func UserProviderAt ¶
func UserProviderAt(address string) (user.UserAPIClient, error)
UserProviderAt returns a user provider client for an explicit address.
func UserShareProvider ¶
func UserShareProvider(ctx context.Context) (collaboration.CollaborationAPIClient, error)
UserShareProvider resolves the user share provider through the global resolver.
Types ¶
type Clients ¶
type Clients interface {
Gateway(ctx context.Context) (gateway.GatewayAPIClient, error)
StorageProvider(ctx context.Context) (storageprovider.ProviderAPIClient, error)
StorageRegistry(ctx context.Context) (storageregistry.RegistryAPIClient, error)
Spaces(ctx context.Context) (storageprovider.SpacesAPIClient, error)
AuthProvider(ctx context.Context) (authprovider.ProviderAPIClient, error)
AuthRegistry(ctx context.Context) (authregistry.RegistryAPIClient, error)
AppAuthProvider(ctx context.Context) (applicationauth.ApplicationsAPIClient, error)
UserProvider(ctx context.Context) (user.UserAPIClient, error)
GroupProvider(ctx context.Context) (group.GroupAPIClient, error)
OCMInviteManager(ctx context.Context) (invitepb.InviteAPIClient, error)
OCMProviderAuthorizer(ctx context.Context) (ocmprovider.ProviderAPIClient, error)
OCMIncoming(ctx context.Context) (ocmincoming.OcmIncomingAPIClient, error)
Preferences(ctx context.Context) (preferences.PreferencesAPIClient, error)
Permissions(ctx context.Context) (permissions.PermissionsAPIClient, error)
AppRegistry(ctx context.Context) (appregistry.RegistryAPIClient, error)
AppProvider(ctx context.Context) (appprovider.ProviderAPIClient, error)
DataTx(ctx context.Context) (datatx.TxAPIClient, error)
Labels(ctx context.Context) (labels.LabelsAPIClient, error)
// Degrade marks the node at address degraded and passes it over locally.
Degrade(service, address string)
// HTTPEndpoint resolves one ready node matching the filters; HTTPEndpoints
// returns all of them. Used for HTTP services whose URL is needed (data
// gateway, data provider).
HTTPEndpoint(ctx context.Context, opts ...EndpointOption) (Endpoint, error)
HTTPEndpoints(ctx context.Context, opts ...EndpointOption) ([]Endpoint, error)
}
Clients resolves a peer by kind and returns a typed CS3 client; resolution, selection and dialing happen below the call.
func Global ¶
func Global() Clients
Global returns the process-wide resolver, or nil if none was set.
func NewClients ¶
NewClients builds a resolver over the registry, one per Reva instance.
type Endpoint ¶
type Endpoint interface {
Name() string // service name
Address() string // bind "host:port"
Host() string
Port() string
Scheme() string // "http" | "https"
Prefix() string // URL path prefix
URL() string // public_url, else scheme://address/prefix
Meta(key string) string // single metadata value
Metadata() map[string]string // all advertised metadata
Node() registry.Node // raw node
}
Endpoint is a resolved registry node with convenience accessors over its address and metadata. It is returned by HTTPEndpoint(s) for services whose reachable URL another service needs (data gateway, data provider, ...).
func HTTPEndpoint ¶
func HTTPEndpoint(ctx context.Context, opts ...EndpointOption) (Endpoint, error)
HTTPEndpoint resolves one ready HTTP endpoint matching the filters through the global resolver.
func HTTPEndpoints ¶
func HTTPEndpoints(ctx context.Context, opts ...EndpointOption) ([]Endpoint, error)
HTTPEndpoints resolves every ready HTTP endpoint matching the filters through the global resolver.
type EndpointOption ¶
type EndpointOption func(*endpointQuery)
EndpointOption narrows the candidate node set.
func ByMetadata ¶
func ByMetadata(key, value string) EndpointOption
ByMetadata keeps only nodes whose metadata[key] == value. Repeatable.
type FirstSelector ¶
type FirstSelector struct{}
FirstSelector returns the first selectable node (the default).
type MetadataProvider ¶
MetadataProvider is implemented by a service that wants to advertise extra metadata (e.g. mount_id, public_url) on its registry node. The runtime merges RegistryMetadata() over the framework-derived keys at registration.
type RandomSelector ¶
type RandomSelector struct{}
type RoundRobinSelector ¶
type RoundRobinSelector struct {
// contains filtered or unexported fields
}