Expand description
§Intrepid Model
Intrepid is a magic handler kit where most of the boilerplate work is already done. For cases where you’d like to get the ergonomics of Bevy or Actix-Web, but for your own stuff.
Intrepid model establishes some basic plumbing for intrepid systems that lets implementers use intrepid in immediately useful ways.
Cache
, which is a key/value abstraction that lets intrepid functions easily save and access stored value.- [
Events
], which is a message distribution abastraction that lets intrepid functions create and work over event streams, even persisted logs.
Together, these are enough to build out a lot of prototypical systems, using a “messages & memos” approach, where dozens of different kinds of typesafe messages and typesafe data structures can be orchestrated in a single serializable JSON-backed metaphor.
Structs§
- Cache
Connection - A connection to a cache repo.
- Cache
Record - A record in a cache. This is designed to represent values in a simple
key-value store, and so it has minimal fields. The
uri
field is the key, and thedata
field is the value. An extrameta
field is included for additional information that may be useful, like timestamps or other bits that might not make sense to store in thedata
field. - Event
- An event in a stream. This is slimmer than the
EventRecord
type, and is used for most public interactions with events. - Event
Record - A record of an event. This is designed to represent events in a log, and so
it has more fields than a
CacheRecord
. - Subscription
- A subscription to a stream of events. Subscriptions read events from a target stream
and manage a tracking stream to measure their progress. Subscriptions generate their own
ids when they are created, meaning every subscription is unique and replays the target
stream from the beginning. In order to avoid replaying the target stream, use the
Subscription::resume
method and give it the id of an existing subscription. - Subscription
Collection - A collection of subscriptions to streams of events.
- Subscription
Config - A configuration for a subscription to a stream of events.
- Subscription
Marker - A marker struct to track subscription read progress.
- Subscription
Name - Subscription names are used to identify streams that subscriptions read from. They are URI shaped, and must be valid URI strings.
- Subscription
Stream - A handle to a subscription process. Creating a subscription handle will start a background process that will read events from the target stream, and send those events to the handle’s inbox for foreground processing.
- Subscription
Worker - A backgrounded subscription. This process works like an “actor”, as described in
this blog post. It does the work to read from the event log and send
any new events to a [subscription handle][super::SubscriptionHandle]. Usually,
subscription processes aren’t interacted with directly, but are created by
[
Subscriber::background
][super::Subscriber::background]. - Subscription
Worker Map - A map of subscription processes which can be run as a stream.
Enums§
- Cache
- When dealing with caches, fetch values are the most common operation. This
enum represents the result of a fetch operation, and can be used to determine
if you’ve got a cache miss or not. It works a lot like the
Option
enum, but with a bit more context. - Cache
Repo Error - An error that can occur when interacting with a cache repository.
- Event
Kind - The kind of an event. This is used to differentiate between the events in an event stream log. Entry events are the most common, and represent an event that has occurred. Marker events are used to indicate a point in a log which is significant for the system, but not for consumers.
- Event
Repo Error - Errors that can occur when interacting with an event repository.
Traits§
- Cache
Repo - The trait for a cache repository. Implement this trait to provide a cache repository interface for any given cache implementation.
- Event
Repo - The trait for an event repository. Implement this trait to provide an event repository interface for any given event storage implementation.
- Into
Cache - A trait for types that can be converted into a cache record. Any given type that implements this trait can be inserted into a cache.
- Into
Event - A trait for types that can be converted into an event. Any given type that implements this trait can be published as an event.
- Intrepid
Repo - An intrepid repository combines the functionality of a cache and an event repo, and is automatically implemented for any type that implements both.
- Subscription
Topic - Implement this trait for a type that can be used as a subscription topic. That means
that the type can be used to create a subscription to a stream of events using the
Subscription
type.
Type Aliases§
- Event
Log - Convenience type for a vec of event records
- Pending
Events - Convenience type for a vec of events