Documentation
¶
Overview ¶
Package events defines message types emitted by the service for downstream consumers (audit, projections, integrations).
Index ¶
- type Bus
- func (b *Bus) Publish(ctx context.Context, topic EventType, payload any)
- func (b *Bus) PublishSync(ctx context.Context, topic EventType, payload any)
- func (b *Bus) Subscribe(topic EventType, handler EventSubscriberFunc)
- func (b *Bus) SubscribeComputeAllocationCreated(handler ComputeAllocationHandler)
- func (b *Bus) SubscribeComputeAllocationDeleted(handler ComputeAllocationHandler)
- func (b *Bus) SubscribeComputeAllocationDiffCreated(handler ComputeAllocationDiffHandler)
- func (b *Bus) SubscribeComputeAllocationDiffDeleted(handler ComputeAllocationDiffHandler)
- func (b *Bus) SubscribeComputeAllocationDiffUpdated(handler ComputeAllocationDiffHandler)
- func (b *Bus) SubscribeComputeAllocationMembershipCreated(handler ComputeAllocationMembershipHandler)
- func (b *Bus) SubscribeComputeAllocationMembershipDeleted(handler ComputeAllocationMembershipHandler)
- func (b *Bus) SubscribeComputeAllocationMembershipResourceOverrideCreated(handler ComputeAllocationMembershipResourceOverrideHandler)
- func (b *Bus) SubscribeComputeAllocationMembershipResourceOverrideDeleted(handler ComputeAllocationMembershipResourceOverrideHandler)
- func (b *Bus) SubscribeComputeAllocationMembershipResourceOverrideUpdated(handler ComputeAllocationMembershipResourceOverrideHandler)
- func (b *Bus) SubscribeComputeAllocationMembershipUpdated(handler ComputeAllocationMembershipHandler)
- func (b *Bus) SubscribeComputeAllocationResourceCreated(handler ComputeAllocationResourceHandler)
- func (b *Bus) SubscribeComputeAllocationResourceDeleted(handler ComputeAllocationResourceHandler)
- func (b *Bus) SubscribeComputeAllocationResourceMappingCreated(handler ComputeAllocationResourceMappingHandler)
- func (b *Bus) SubscribeComputeAllocationResourceMappingDeleted(handler ComputeAllocationResourceMappingHandler)
- func (b *Bus) SubscribeComputeAllocationResourceMappingUpdated(handler ComputeAllocationResourceMappingHandler)
- func (b *Bus) SubscribeComputeAllocationResourceUpdated(handler ComputeAllocationResourceHandler)
- func (b *Bus) SubscribeComputeAllocationUpdated(handler ComputeAllocationHandler)
- func (b *Bus) SubscribeComputeClusterUserCreated(handler ComputeClusterUserHandler)
- func (b *Bus) SubscribeComputeClusterUserDeleted(handler ComputeClusterUserHandler)
- func (b *Bus) SubscribeComputeClusterUserUpdated(handler ComputeClusterUserHandler)
- func (b *Bus) SubscribeOrganizationCreated(handler OrganizationHandler)
- func (b *Bus) SubscribeOrganizationDeleted(handler OrganizationHandler)
- func (b *Bus) SubscribeOrganizationUpdated(handler OrganizationHandler)
- func (b *Bus) SubscribeProjectCreated(handler ProjectHandler)
- func (b *Bus) SubscribeProjectDeleted(handler ProjectHandler)
- func (b *Bus) SubscribeProjectUpdated(handler ProjectHandler)
- func (b *Bus) SubscribeUserCreated(handler UserHandler)
- func (b *Bus) SubscribeUserDeleted(handler UserHandler)
- func (b *Bus) SubscribeUserIdentityCreated(handler UserIdentityHandler)
- func (b *Bus) SubscribeUserIdentityDeleted(handler UserIdentityHandler)
- func (b *Bus) SubscribeUserIdentityUpdated(handler UserIdentityHandler)
- func (b *Bus) SubscribeUserUpdated(handler UserHandler)
- type ComputeAllocationDiffHandler
- type ComputeAllocationHandler
- type ComputeAllocationMembershipHandler
- type ComputeAllocationMembershipResourceOverrideHandler
- type ComputeAllocationResourceHandler
- type ComputeAllocationResourceMappingHandler
- type ComputeClusterUserHandler
- type Event
- type EventSubscriberFunc
- type EventType
- type OrganizationHandler
- type ProjectHandler
- type UserHandler
- type UserIdentityHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus is a lightweight, in-memory, topic-based pub/sub event bus. Modules publish and subscribe by topic without knowing about each other.
func (*Bus) Publish ¶
Publish sends an event to all subscribers of the given topic. Each handler runs in its own goroutine so publishers never block.
func (*Bus) PublishSync ¶
PublishSync is like Publish but calls handlers in the caller's goroutine. Useful when you need to guarantee ordering or want backpressure.
func (*Bus) Subscribe ¶
func (b *Bus) Subscribe(topic EventType, handler EventSubscriberFunc)
Subscribe registers a handler for a given topic. The handler is called asynchronously (in a new goroutine) each time an event is published on that topic.
func (*Bus) SubscribeComputeAllocationCreated ¶
func (b *Bus) SubscribeComputeAllocationCreated(handler ComputeAllocationHandler)
SubscribeComputeAllocationCreated registers a typed handler invoked whenever a compute_allocation::create event is published. Events with payloads that are not a models.ComputeAllocation (or *models.ComputeAllocation) are dropped with a warning log.
func (*Bus) SubscribeComputeAllocationDeleted ¶
func (b *Bus) SubscribeComputeAllocationDeleted(handler ComputeAllocationHandler)
SubscribeComputeAllocationDeleted registers a typed handler invoked whenever a compute_allocation::delete event is published.
func (*Bus) SubscribeComputeAllocationDiffCreated ¶
func (b *Bus) SubscribeComputeAllocationDiffCreated(handler ComputeAllocationDiffHandler)
SubscribeComputeAllocationDiffCreated registers a typed handler invoked whenever a compute_allocation_diff::create event is published. Events with payloads that are not a models.ComputeAllocationDiff (or *models.ComputeAllocationDiff) are dropped with a warning log.
func (*Bus) SubscribeComputeAllocationDiffDeleted ¶
func (b *Bus) SubscribeComputeAllocationDiffDeleted(handler ComputeAllocationDiffHandler)
SubscribeComputeAllocationDiffDeleted registers a typed handler invoked whenever a compute_allocation_diff::delete event is published.
func (*Bus) SubscribeComputeAllocationDiffUpdated ¶
func (b *Bus) SubscribeComputeAllocationDiffUpdated(handler ComputeAllocationDiffHandler)
SubscribeComputeAllocationDiffUpdated registers a typed handler invoked whenever a compute_allocation_diff::update event is published.
func (*Bus) SubscribeComputeAllocationMembershipCreated ¶
func (b *Bus) SubscribeComputeAllocationMembershipCreated(handler ComputeAllocationMembershipHandler)
SubscribeComputeAllocationMembershipCreated registers a typed handler invoked whenever a compute_allocation_membership::create event is published. Events with payloads that are not a models.ComputeAllocationMembership (or *models.ComputeAllocationMembership) are dropped with a warning log.
func (*Bus) SubscribeComputeAllocationMembershipDeleted ¶
func (b *Bus) SubscribeComputeAllocationMembershipDeleted(handler ComputeAllocationMembershipHandler)
SubscribeComputeAllocationMembershipDeleted registers a typed handler invoked whenever a compute_allocation_membership::delete event is published.
func (*Bus) SubscribeComputeAllocationMembershipResourceOverrideCreated ¶
func (b *Bus) SubscribeComputeAllocationMembershipResourceOverrideCreated(handler ComputeAllocationMembershipResourceOverrideHandler)
SubscribeComputeAllocationMembershipResourceOverrideCreated registers a typed handler invoked whenever a compute_allocation_membership_resource_override::create event is published.
func (*Bus) SubscribeComputeAllocationMembershipResourceOverrideDeleted ¶
func (b *Bus) SubscribeComputeAllocationMembershipResourceOverrideDeleted(handler ComputeAllocationMembershipResourceOverrideHandler)
SubscribeComputeAllocationMembershipResourceOverrideDeleted registers a typed handler invoked whenever a compute_allocation_membership_resource_override::delete event is published.
func (*Bus) SubscribeComputeAllocationMembershipResourceOverrideUpdated ¶
func (b *Bus) SubscribeComputeAllocationMembershipResourceOverrideUpdated(handler ComputeAllocationMembershipResourceOverrideHandler)
SubscribeComputeAllocationMembershipResourceOverrideUpdated registers a typed handler invoked whenever a compute_allocation_membership_resource_override::update event is published.
func (*Bus) SubscribeComputeAllocationMembershipUpdated ¶
func (b *Bus) SubscribeComputeAllocationMembershipUpdated(handler ComputeAllocationMembershipHandler)
SubscribeComputeAllocationMembershipUpdated registers a typed handler invoked whenever a compute_allocation_membership::update event is published.
func (*Bus) SubscribeComputeAllocationResourceCreated ¶
func (b *Bus) SubscribeComputeAllocationResourceCreated(handler ComputeAllocationResourceHandler)
SubscribeComputeAllocationResourceCreated registers a typed handler invoked whenever a compute_allocation_resource::create event is published. Events with payloads that are not a models.ComputeAllocationResource (or *models.ComputeAllocationResource) are dropped with a warning log.
func (*Bus) SubscribeComputeAllocationResourceDeleted ¶
func (b *Bus) SubscribeComputeAllocationResourceDeleted(handler ComputeAllocationResourceHandler)
SubscribeComputeAllocationResourceDeleted registers a typed handler invoked whenever a compute_allocation_resource::delete event is published.
func (*Bus) SubscribeComputeAllocationResourceMappingCreated ¶
func (b *Bus) SubscribeComputeAllocationResourceMappingCreated(handler ComputeAllocationResourceMappingHandler)
SubscribeComputeAllocationResourceMappingCreated registers a typed handler invoked whenever a compute_allocation_resource_mapping::create event is published. Events with payloads that are not a models.ComputeAllocationResourceMapping (or *models.ComputeAllocationResourceMapping) are dropped with a warning log.
func (*Bus) SubscribeComputeAllocationResourceMappingDeleted ¶
func (b *Bus) SubscribeComputeAllocationResourceMappingDeleted(handler ComputeAllocationResourceMappingHandler)
SubscribeComputeAllocationResourceMappingDeleted registers a typed handler invoked whenever a compute_allocation_resource_mapping::delete event is published.
func (*Bus) SubscribeComputeAllocationResourceMappingUpdated ¶
func (b *Bus) SubscribeComputeAllocationResourceMappingUpdated(handler ComputeAllocationResourceMappingHandler)
SubscribeComputeAllocationResourceMappingUpdated registers a typed handler invoked whenever a compute_allocation_resource_mapping::update event is published.
func (*Bus) SubscribeComputeAllocationResourceUpdated ¶
func (b *Bus) SubscribeComputeAllocationResourceUpdated(handler ComputeAllocationResourceHandler)
SubscribeComputeAllocationResourceUpdated registers a typed handler invoked whenever a compute_allocation_resource::update event is published.
func (*Bus) SubscribeComputeAllocationUpdated ¶
func (b *Bus) SubscribeComputeAllocationUpdated(handler ComputeAllocationHandler)
SubscribeComputeAllocationUpdated registers a typed handler invoked whenever a compute_allocation::update event is published.
func (*Bus) SubscribeComputeClusterUserCreated ¶
func (b *Bus) SubscribeComputeClusterUserCreated(handler ComputeClusterUserHandler)
SubscribeComputeClusterUserCreated registers a typed handler invoked whenever a compute_cluster_user::create event is published.
func (*Bus) SubscribeComputeClusterUserDeleted ¶
func (b *Bus) SubscribeComputeClusterUserDeleted(handler ComputeClusterUserHandler)
SubscribeComputeClusterUserDeleted registers a typed handler invoked whenever a compute_cluster_user::delete event is published.
func (*Bus) SubscribeComputeClusterUserUpdated ¶
func (b *Bus) SubscribeComputeClusterUserUpdated(handler ComputeClusterUserHandler)
SubscribeComputeClusterUserUpdated registers a typed handler invoked whenever a compute_cluster_user::update event is published.
func (*Bus) SubscribeOrganizationCreated ¶
func (b *Bus) SubscribeOrganizationCreated(handler OrganizationHandler)
SubscribeOrganizationCreated registers a typed handler invoked whenever an organization::create event is published. Events with payloads that are not a models.Organization (or *models.Organization) are dropped with a warning log.
func (*Bus) SubscribeOrganizationDeleted ¶
func (b *Bus) SubscribeOrganizationDeleted(handler OrganizationHandler)
SubscribeOrganizationDeleted registers a typed handler invoked whenever an organization::delete event is published.
func (*Bus) SubscribeOrganizationUpdated ¶
func (b *Bus) SubscribeOrganizationUpdated(handler OrganizationHandler)
SubscribeOrganizationUpdated registers a typed handler invoked whenever an organization::update event is published.
func (*Bus) SubscribeProjectCreated ¶
func (b *Bus) SubscribeProjectCreated(handler ProjectHandler)
SubscribeProjectCreated registers a typed handler invoked whenever a project::create event is published. Events with payloads that are not a models.Project (or *models.Project) are dropped with a warning log.
func (*Bus) SubscribeProjectDeleted ¶
func (b *Bus) SubscribeProjectDeleted(handler ProjectHandler)
SubscribeProjectDeleted registers a typed handler invoked whenever a project::delete event is published. Events with payloads that are not a models.Project (or *models.Project) are dropped with a warning log.
func (*Bus) SubscribeProjectUpdated ¶
func (b *Bus) SubscribeProjectUpdated(handler ProjectHandler)
SubscribeProjectUpdated registers a typed handler invoked whenever a project::update event is published. Events with payloads that are not a models.Project (or *models.Project) are dropped with a warning log.
func (*Bus) SubscribeUserCreated ¶
func (b *Bus) SubscribeUserCreated(handler UserHandler)
SubscribeUserCreated registers a typed handler invoked whenever a user::create event is published. Events with payloads that are not a models.User (or *models.User) are dropped with a warning log.
func (*Bus) SubscribeUserDeleted ¶
func (b *Bus) SubscribeUserDeleted(handler UserHandler)
SubscribeUserDeleted registers a typed handler invoked whenever a user::delete event is published.
func (*Bus) SubscribeUserIdentityCreated ¶
func (b *Bus) SubscribeUserIdentityCreated(handler UserIdentityHandler)
SubscribeUserIdentityCreated registers a typed handler invoked whenever a user_identity::create event is published.
func (*Bus) SubscribeUserIdentityDeleted ¶
func (b *Bus) SubscribeUserIdentityDeleted(handler UserIdentityHandler)
SubscribeUserIdentityDeleted registers a typed handler invoked whenever a user_identity::delete event is published.
func (*Bus) SubscribeUserIdentityUpdated ¶
func (b *Bus) SubscribeUserIdentityUpdated(handler UserIdentityHandler)
SubscribeUserIdentityUpdated registers a typed handler invoked whenever a user_identity::update event is published.
func (*Bus) SubscribeUserUpdated ¶
func (b *Bus) SubscribeUserUpdated(handler UserHandler)
SubscribeUserUpdated registers a typed handler invoked whenever a user::update event is published.
type ComputeAllocationDiffHandler ¶
type ComputeAllocationDiffHandler func(ctx context.Context, diff models.ComputeAllocationDiff)
ComputeAllocationDiffHandler handles compute allocation diff lifecycle events with a typed payload.
type ComputeAllocationHandler ¶
type ComputeAllocationHandler func(ctx context.Context, allocation models.ComputeAllocation)
ComputeAllocationHandler handles compute allocation lifecycle events with a typed payload.
type ComputeAllocationMembershipHandler ¶
type ComputeAllocationMembershipHandler func(ctx context.Context, membership models.ComputeAllocationMembership)
ComputeAllocationMembershipHandler handles compute allocation membership lifecycle events with a typed payload.
type ComputeAllocationMembershipResourceOverrideHandler ¶
type ComputeAllocationMembershipResourceOverrideHandler func(ctx context.Context, o models.ComputeAllocationMembershipResourceOverride)
ComputeAllocationMembershipResourceOverrideHandler handles lifecycle events for membership resource overrides with a typed payload.
type ComputeAllocationResourceHandler ¶
type ComputeAllocationResourceHandler func(ctx context.Context, resource models.ComputeAllocationResource)
ComputeAllocationResourceHandler handles compute allocation resource lifecycle events with a typed payload.
type ComputeAllocationResourceMappingHandler ¶
type ComputeAllocationResourceMappingHandler func(ctx context.Context, mapping models.ComputeAllocationResourceMapping)
ComputeAllocationResourceMappingHandler handles compute allocation resource mapping lifecycle events with a typed payload.
type ComputeClusterUserHandler ¶
type ComputeClusterUserHandler func(ctx context.Context, user models.ComputeClusterUser)
ComputeClusterUserHandler handles compute-cluster user lifecycle events with a typed payload.
type Event ¶
type Event struct {
Type EventType `json:"type"`
Payload interface{} `json:"payload"`
}
Event represents a change in the system that downstream consumers may be interested in. The payload is the full record after the change (e.g. the new state of a project after an update).
type EventSubscriberFunc ¶
EventSubscriberFunc is a function type that can be registered to receive events from the bus.
type EventType ¶
type EventType string
EventType identifies the kind of event carried on the bus.
const ( ProjectCreateEvent EventType = "project::create" ProjectUpdateEvent EventType = "project::update" ProjectDeleteEvent EventType = "project::delete" )
Project lifecycle message types.
const ( UserCreateEvent EventType = "user::create" UserUpdateEvent EventType = "user::update" UserDeleteEvent EventType = "user::delete" )
User lifecycle message types.
const ( OrganizationCreateEvent EventType = "organization::create" OrganizationUpdateEvent EventType = "organization::update" OrganizationDeleteEvent EventType = "organization::delete" )
Organization lifecycle message types.
const ( ComputeClusterCreateEvent EventType = "compute_cluster::create" ComputeClusterUpdateEvent EventType = "compute_cluster::update" ComputeClusterDeleteEvent EventType = "compute_cluster::delete" )
ComputeCluster lifecycle message types.
const ( ComputeClusterUserCreateEvent EventType = "compute_cluster_user::create" ComputeClusterUserUpdateEvent EventType = "compute_cluster_user::update" ComputeClusterUserDeleteEvent EventType = "compute_cluster_user::delete" )
ComputeClusterUser lifecycle message types.
const ( ClusterAccountCreateEvent EventType = "cluster_account::create" ClusterAccountUpdateEvent EventType = "cluster_account::update" ClusterAccountDeleteEvent EventType = "cluster_account::delete" )
ClusterAccount lifecycle message types.
const ( ComputeAllocationCreateEvent EventType = "compute_allocation::create" ComputeAllocationUpdateEvent EventType = "compute_allocation::update" ComputeAllocationDeleteEvent EventType = "compute_allocation::delete" )
ComputeAllocation lifecycle message types.
const ( ComputeAllocationDiffCreateEvent EventType = "compute_allocation_diff::create" ComputeAllocationDiffUpdateEvent EventType = "compute_allocation_diff::update" ComputeAllocationDiffDeleteEvent EventType = "compute_allocation_diff::delete" )
CreateComputeAllocationDiff lifecycle message types.
const ( ComputeAllocationResourceCreateEvent EventType = "compute_allocation_resource::create" ComputeAllocationResourceUpdateEvent EventType = "compute_allocation_resource::update" ComputeAllocationResourceDeleteEvent EventType = "compute_allocation_resource::delete" )
ComputeAllocationResource lifecycle message types.
const ( ComputeAllocationMembershipCreateEvent EventType = "compute_allocation_membership::create" ComputeAllocationMembershipUpdateEvent EventType = "compute_allocation_membership::update" ComputeAllocationMembershipDeleteEvent EventType = "compute_allocation_membership::delete" )
ComputeAllocationMembership lifecycle message types.
const ( ComputeAllocationMembershipResourceOverrideCreateEvent EventType = "compute_allocation_membership_resource_override::create" ComputeAllocationMembershipResourceOverrideUpdateEvent EventType = "compute_allocation_membership_resource_override::update" ComputeAllocationMembershipResourceOverrideDeleteEvent EventType = "compute_allocation_membership_resource_override::delete" )
ComputeAllocationMembershipResourceOverride lifecycle message types.
const ( ComputeAllocationResourceMappingCreateEvent EventType = "compute_allocation_resource_mapping::create" ComputeAllocationResourceMappingUpdateEvent EventType = "compute_allocation_resource_mapping::update" ComputeAllocationResourceMappingDeleteEvent EventType = "compute_allocation_resource_mapping::delete" )
ComputeAllocationResourceMapping lifecycle message types.
type OrganizationHandler ¶
type OrganizationHandler func(ctx context.Context, organization models.Organization)
OrganizationHandler handles organization lifecycle events with a typed payload.
type ProjectHandler ¶
ProjectHandler handles project lifecycle events with a typed payload.
type UserHandler ¶
UserHandler handles user lifecycle events with a typed payload.
type UserIdentityHandler ¶
type UserIdentityHandler func(ctx context.Context, identity models.UserIdentity)
UserIdentityHandler handles user-identity lifecycle events with a typed payload.
Source Files
¶
- bus.go
- compute_allocation_diff_subscribe.go
- compute_allocation_membership_resource_override_subscribe.go
- compute_allocation_membership_subscribe.go
- compute_allocation_resource_mapping_subscribe.go
- compute_allocation_resource_subscribe.go
- compute_allocation_subscribe.go
- compute_cluster_user_subscribe.go
- organization_subscribe.go
- project_subscribe.go
- types.go
- user_identity_subscribe.go
- user_subscribe.go