driver

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CommServiceID = reflect.TypeOf((*CommService)(nil))
)

Functions

This section is empty.

Types

type AuditRegistry

type AuditRegistry = driver.AuditRegistry

AuditRegistry models a repository of identities' audit information

func GetAuditRegistry

func GetAuditRegistry(sp ServiceProvider) AuditRegistry

type CommService added in v0.3.0

type CommService interface {
	Addresses(id view.Identity) ([]string, error)
}

func GetCommService added in v0.3.0

func GetCommService(ctx ServiceProvider) CommService

GetCommService returns an instance of the communication service. It panics, if no instance is found.

type ConfigService

type ConfigService interface {
	// GetString returns the value associated with the key as a string
	GetString(key string) string
	// GetInt returns the value associated with the key as an integer
	GetInt(key string) int
	// GetDuration returns the value associated with the key as a duration
	GetDuration(key string) time.Duration
	// GetBool returns the value associated with the key asa boolean
	GetBool(key string) bool
	// GetStringSlice returns the value associated with the key as a slice of strings
	GetStringSlice(key string) []string
	// IsSet checks to see if the key has been set in any of the data locations
	IsSet(key string) bool
	// UnmarshalKey takes a single key and unmarshals it into a Struct
	UnmarshalKey(key string, rawVal interface{}) error
	// ConfigFileUsed returns the file used to populate the config registry
	ConfigFileUsed() string
	// GetPath allows configuration strings that specify a (config-file) relative path
	GetPath(key string) string
	// TranslatePath translates the passed path relative to the config path
	TranslatePath(path string) string
}

ConfigService models a configuration registry

func GetConfigService

func GetConfigService(sp ServiceProvider) ConfigService

GetConfigService returns an instance of the config service. It panics, if no instance is found.

type DecodeHookFuncType

type DecodeHookFuncType func(reflect.Type, reflect.Type, interface{}) (interface{}, error)

type EndpointService

type EndpointService interface {
	// Resolve returns the identity the passed identity is bound to.
	// It returns also: the endpoints and the pkiID
	Resolve(party view.Identity) (string, view.Identity, map[PortName]string, []byte, error)

	// GetIdentity returns an identity bound to either the passed label or public-key identifier.
	GetIdentity(label string, pkiID []byte) (view.Identity, error)

	// Bind binds b to identity a
	Bind(b view.Identity, a view.Identity) error

	// IsBoundTo returns true if b was bound to a
	IsBoundTo(a view.Identity, b view.Identity) bool

	// AddResolver adds a resolver for tha passed parameters. The passed id can be retrieved by using the passed name in a call to GetIdentity method.
	// The addresses can retrieved by passing the identity in a call to Resolve.
	// If a resolver is already bound to the passed name, then the passed identity is linked to the already existing identity. The already existing
	// identity is returned
	AddResolver(name string, domain string, addresses map[string]string, aliases []string, id []byte) (view.Identity, error)

	// AddPublicKeyExtractor add a new PK extractor
	AddPublicKeyExtractor(pkExtractor PublicKeyExtractor) error

	SetPublicKeyIDSynthesizer(synthesizer PublicKeyIDSynthesizer)
}

EndpointService models the endpoint service

func GetEndpointService

func GetEndpointService(ctx ServiceProvider) EndpointService

GetEndpointService returns an instance of the endpoint service. It panics, if no instance is found.

type Factory

type Factory interface {
	// NewView returns an instance of the View interface build using the passed argument.
	NewView(in []byte) (view.View, error)
}

Factory is used to create instances of the View interface

type Identity

type Identity = driver.VerifyingIdentity

type IdentityProvider

type IdentityProvider interface {
	// DefaultIdentity returns the default identity known by this provider
	DefaultIdentity() view.Identity
	// Identity returns the identity bound to the passed label
	Identity(label string) view.Identity
	// Admins returns the identities of the administrators
	Admins() []view.Identity
	// Clients returns the identities of the clients of this node
	Clients() []view.Identity
}

IdentityProvider models the identity provider

func GetIdentityProvider

func GetIdentityProvider(sp ServiceProvider) IdentityProvider

GetIdentityProvider returns an instance of the IdentityProvider interface. It panics, if no instance is found.

type PortName

type PortName string

PortName is the type variable for the socket ports

const (
	// ListenPort is the port at which the FSC node might listen for some service
	ListenPort PortName = "Listen"
	// ViewPort is the port on which the View Service Server respond
	ViewPort PortName = "View"
	// P2PPort is the port on which the P2P Communication Layer respond
	P2PPort PortName = "P2P"
)

type PublicKeyExtractor added in v0.4.0

type PublicKeyExtractor interface {
	// ExtractPublicKey returns the public key corresponding to the passed identity
	ExtractPublicKey(id view.Identity) (any, error)
}

PublicKeyExtractor extracts public keys from identities

type PublicKeyIDSynthesizer added in v0.4.0

type PublicKeyIDSynthesizer interface {
	PublicKeyID(any) []byte
}

type Registry

type Registry interface {
	// GetIdentifier returns the identifier of the passed view
	GetIdentifier(f view.View) string

	// RegisterFactory binds an id to a View Factory
	RegisterFactory(id string, factory Factory) error

	// RegisterResponder binds a responder to an initiator.
	// The responder is the view that will be called when the initiator (initiatedBy) contacts the FSC node where
	// this RegisterResponder is invoked.
	// The argument initiatedBy can be a view or a view identifier.
	// If a view is passed, its identifier is computed and used to register the responder.
	RegisterResponder(responder view.View, initiatedBy interface{}) error

	// RegisterResponderWithIdentity binds the pair <responder, id> to an initiator.
	// The responder is the view that will be called when the initiator (initiatedBy) contacts the FSC node where
	// this RegisterResponderWithIdentity is invoked.
	// The argument initiatedBy can be a view or a view identifier.
	// If a view is passed, its identifier is computed and used to register the responder.
	RegisterResponderWithIdentity(responder view.View, id view.Identity, initiatedBy interface{}) error

	// GetResponder returns the responder for the passed initiator.
	GetResponder(initiatedBy interface{}) (view.View, error)
}

Registry keeps track of the available view and view factories

func GetRegistry

func GetRegistry(sp ServiceProvider) Registry

type ServiceProvider

type ServiceProvider interface {
	// GetService returns an instance of the given type
	GetService(v interface{}) (interface{}, error)
}

ServiceProvider is used to return instances of a given type

type Session

type Session interface {
	view.Session
}

Session encapsulates a communication channel to an endpoint

type SigRegistry

type SigRegistry = driver.SigRegistry

func GetSigRegistry

func GetSigRegistry(sp ServiceProvider) SigRegistry

type SigService

type SigService = driver.SigService

SigService models a repository of sign and verify keys.

func GetSigService

func GetSigService(sp ServiceProvider) SigService

type Signer

type Signer = driver.Signer

Signer is an interface which wraps the Sign method.

type SigningIdentity

type SigningIdentity = driver.SigningIdentity

type Verifier

type Verifier = driver.Verifier

Verifier is an interface which wraps the Verify method.

type ViewManager

type ViewManager interface {
	// NewView returns a new instance of the view identified by the passed id and on input
	NewView(id string, in []byte) (view.View, error)
	// Context returns the context associated to the passed id, an error if not context is found.
	Context(contextID string) (view.Context, error)
	// InitiateView invokes the passed view and returns the result produced by that view
	InitiateView(view view.View, ctx context.Context) (interface{}, error)
	// InitiateContext initiates a new context for the passed view
	InitiateContext(view view.View) (view.Context, error)
	// InitiateContextWithIdentityAndID initiates a new context
	InitiateContextWithIdentityAndID(view view.View, id view.Identity, contextID string) (view.Context, error)
	// InitiateContextFrom initiates a new context for the passed view, derived from the passed context
	InitiateContextFrom(ctx context.Context, view view.View, id view.Identity, contextID string) (view.Context, error)
}

ViewManager manages the lifecycle of views and contexts

func GetViewManager

func GetViewManager(sp ServiceProvider) ViewManager

GetViewManager returns an instance of the view manager. It panics, if no instance is found.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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