Documentation
¶
Overview ¶
Package events is a generated GoMock package.
Index ¶
- type MockService
- type MockServiceMockRecorder
- type Service
- type ServiceHandler
- func (h *ServiceHandler) CreateEvent(ctx context.Context, orgId uuid.UUID, event *domain.Event)
- func (h *ServiceHandler) CreateEventWithRetry(ctx context.Context, orgId uuid.UUID, event *domain.Event) error
- func (h *ServiceHandler) HandleGenericResourceDeletedEvents(ctx context.Context, resourceKind domain.ResourceKind, orgId uuid.UUID, ...)
- func (h *ServiceHandler) SetWorkerClient(workerClient worker_client.WorkerClient)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockService ¶ added in v1.4.0
type MockService struct {
// contains filtered or unexported fields
}
MockService is a mock of Service interface.
func NewMockService ¶ added in v1.4.0
func NewMockService(ctrl *gomock.Controller) *MockService
NewMockService creates a new mock instance.
func (*MockService) CreateEvent ¶ added in v1.4.0
CreateEvent mocks base method.
func (*MockService) EXPECT ¶ added in v1.4.0
func (m *MockService) EXPECT() *MockServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockService) HandleGenericResourceDeletedEvents ¶ added in v1.4.0
func (m *MockService) HandleGenericResourceDeletedEvents(ctx context.Context, resourceKind domain.ResourceKind, orgId uuid.UUID, name string, oldResource, newResource any, created bool, err error)
HandleGenericResourceDeletedEvents mocks base method.
type MockServiceMockRecorder ¶ added in v1.4.0
type MockServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockServiceMockRecorder is the mock recorder for MockService.
func (*MockServiceMockRecorder) CreateEvent ¶ added in v1.4.0
func (mr *MockServiceMockRecorder) CreateEvent(ctx, orgId, event any) *gomock.Call
CreateEvent indicates an expected call of CreateEvent.
func (*MockServiceMockRecorder) HandleGenericResourceDeletedEvents ¶ added in v1.4.0
func (mr *MockServiceMockRecorder) HandleGenericResourceDeletedEvents(ctx, resourceKind, orgId, name, oldResource, newResource, created, err any) *gomock.Call
HandleGenericResourceDeletedEvents indicates an expected call of HandleGenericResourceDeletedEvents.
type Service ¶
type Service interface {
CreateEvent(ctx context.Context, orgId uuid.UUID, event *domain.Event)
HandleGenericResourceDeletedEvents(ctx context.Context, resourceKind domain.ResourceKind, orgId uuid.UUID, name string, oldResource, newResource interface{}, created bool, err error)
}
Service is the generic events-emission core. It intentionally holds only the logic that makes no per-resource decisions: writing an event record, and emitting the generic "resource deleted" event (which needs nothing resource-specific beyond a kind and name). Every resource-specific event decision (what changed, which condition flipped, which message applies) lives in that resource's own internal/service/{resource} package, which calls back into this interface only for these generic parts. This keeps Service from becoming a hub every resource package must depend on for domain-specific logic.
type ServiceHandler ¶
type ServiceHandler struct {
// contains filtered or unexported fields
}
func NewServiceHandler ¶
func NewServiceHandler(store eventstore.Store, workerClient worker_client.WorkerClient, log logrus.FieldLogger) *ServiceHandler
NewServiceHandler creates a new events ServiceHandler instance.
func (*ServiceHandler) CreateEvent ¶
CreateEvent creates an event in the store
func (*ServiceHandler) CreateEventWithRetry ¶ added in v1.4.0
func (h *ServiceHandler) CreateEventWithRetry(ctx context.Context, orgId uuid.UUID, event *domain.Event) error
CreateEventWithRetry persists an event and retries queue publication when a concrete worker client exposes publication errors. It is used by the standalone-device PrepareDeltas path, whose delayed render must not depend on a single transient queue write.
func (*ServiceHandler) HandleGenericResourceDeletedEvents ¶
func (h *ServiceHandler) HandleGenericResourceDeletedEvents(ctx context.Context, resourceKind domain.ResourceKind, orgId uuid.UUID, name string, _, _ interface{}, created bool, err error)
HandleGenericResourceDeletedEvents handles generic resource deletion event emission logic
func (*ServiceHandler) SetWorkerClient ¶ added in v1.4.0
func (h *ServiceHandler) SetWorkerClient(workerClient worker_client.WorkerClient)
SetWorkerClient wires the queue publisher after construction. Some workers construct their resource services before opening queue producers; keeping this setter on the concrete handler lets them enable event fan-out once the producer lifecycle is established.