Expand description

Splinter services are a fundamental component of a Splinter network. They provide the application-level business logic, abstracted above the underlying network and circuit layers. The Service API provides a framework for defining services from a Splinter perspective.

Splinter services are effectively message handlers. They receive the bytes of a message and a context for the message (including the originating sender). It is up to the service to parse the message bytes into the format desired.

A service is identified by an ID, which must be unique within a Splinter circuit. It also provides a service type, which indicates what kinds of capabilities the service provides.

There may be more than one service of a given service type on a circuit, though each instance must continue to have a unique ID.

Services are started and stopped explicitly. At these times, the service must either register (at start) or unregister (at stop) itself. In splinter terms, these two operations connect and disconnect the service from a circuit, but the Service API keeps the service circuit- agnostic.

A stand-alone service implementation may be wrapped in a ServiceProcessor, which will manage lower-level messaging and networking needs to talk to applications that implement Splinter node capabilities, such as the Splinter daemon.

Re-exports

pub use error::FactoryCreateError;
pub use error::ServiceConnectionError;
pub use error::ServiceDestroyError;
pub use error::ServiceError;
pub use error::ServiceProcessorError;
pub use error::ServiceSendError;
pub use error::ServiceStartError;
pub use error::ServiceStopError;

Modules

Errors that can occur in a service and service processor

Defines REST API functionality for Splinter services.

Service Argument validation

Structs

The ServiceMessageContext is a struct that provides information about an incoming message.

The ServiceProcessor handles the networking for services. This includes talking to the splinter node, connecting for authorization, registering the services, and routing direct messages to the correct service.

Builds new ServiceProcessors.

Traits

A Service provides message handling for a given service type.

A ServiceFactory creates services.

The ServiceNetworkRegistry trait provides functions to register and unregister the service on the network. It does not expose the circuit membership information directly.

The ServiceNetworkSender trait allows a service to send its own messages, such as replies to the original message or forwarding the message to other services on the same circuit. It does not expose the circuit information directly.