Documentation ¶
Index ¶
- Constants
- Variables
- func New(ctx context.Context, config Config, fileWatcher *fsnotify.Watcher, ...) (*service.Service, error)
- func NewDeviceMetadataFactoryModel(userID, owner, hubID string) func(ctx context.Context) (cqrsAggregate.AggregateModel, error)
- func NewResourceLinksFactoryModel(userID, owner, hubID string) func(ctx context.Context) (cqrsAggregate.AggregateModel, error)
- func NewResourceStateFactoryModel(userID, owner, hubID string) func(ctx context.Context) (cqrsAggregate.AggregateModel, error)
- func NewService(ctx context.Context, config Config, fileWatcher *fsnotify.Watcher, ...) (*service.Service, error)
- func NewServicesMetadataFactoryModel(userID, owner, hubID string) func(ctx context.Context) (cqrsAggregate.AggregateModel, error)
- func PublishEvents(pub eventbus.Publisher, owner, deviceID, resourceID string, ...)
- func RegisterResourceAggregateServer(s grpc.ServiceRegistrar, srv ResourceAggregateServer)
- type APIsConfig
- type Aggregate
- func (a *Aggregate) CancelPendingMetadataUpdates(ctx context.Context, request *commands.CancelPendingMetadataUpdatesRequest) (events []eventstore.Event, err error)
- func (a *Aggregate) CancelResourceCommand(ctx context.Context, request *commands.CancelPendingCommandsRequest) (events []eventstore.Event, err error)
- func (a *Aggregate) ConfirmDeviceMetadataUpdate(ctx context.Context, request *commands.ConfirmDeviceMetadataUpdateRequest) (events []eventstore.Event, err error)
- func (a *Aggregate) ConfirmExpiredServices(ctx context.Context, request *events.ConfirmExpiredServicesRequest) (events []eventstore.Event, err error)
- func (a *Aggregate) ConfirmResourceCreate(ctx context.Context, request *commands.ConfirmResourceCreateRequest) (events []eventstore.Event, err error)
- func (a *Aggregate) ConfirmResourceDelete(ctx context.Context, request *commands.ConfirmResourceDeleteRequest) (events []eventstore.Event, err error)
- func (a *Aggregate) ConfirmResourceRetrieve(ctx context.Context, request *commands.ConfirmResourceRetrieveRequest) (events []eventstore.Event, err error)
- func (a *Aggregate) ConfirmResourceUpdate(ctx context.Context, request *commands.ConfirmResourceUpdateRequest) (events []eventstore.Event, err error)
- func (a *Aggregate) CreateResource(ctx context.Context, request *commands.CreateResourceRequest) (events []eventstore.Event, err error)
- func (a *Aggregate) DeleteResource(ctx context.Context, request *commands.DeleteResourceRequest) (events []eventstore.Event, err error)
- func (a *Aggregate) DeviceID() string
- func (a *Aggregate) HandleCommand(ctx context.Context, cmd cqrsAggregate.Command) ([]eventstore.Event, error)
- func (a *Aggregate) NotifyResourceChanged(ctx context.Context, request *commands.NotifyResourceChangedRequest) (events []eventstore.Event, err error)
- func (a *Aggregate) PublishResourceLinks(ctx context.Context, request *commands.PublishResourceLinksRequest) (events []eventstore.Event, err error)
- func (a *Aggregate) ResourceID() string
- func (a *Aggregate) RetrieveResource(ctx context.Context, request *commands.RetrieveResourceRequest) (events []eventstore.Event, err error)
- func (a *Aggregate) UnpublishResourceLinks(ctx context.Context, request *commands.UnpublishResourceLinksRequest) (events []eventstore.Event, err error)
- func (a *Aggregate) UpdateDeviceMetadata(ctx context.Context, request *commands.UpdateDeviceMetadataRequest) (events []eventstore.Event, err error)
- func (a *Aggregate) UpdateDeviceToOffline(ctx context.Context, request *events.UpdateDeviceToOfflineRequest) (events []eventstore.Event, err error)
- func (a *Aggregate) UpdateResource(ctx context.Context, request *commands.UpdateResourceRequest) (events []eventstore.Event, err error)
- func (a *Aggregate) UpdateServiceMetadata(ctx context.Context, request *commands.UpdateServiceMetadataRequest) (events []eventstore.Event, err error)
- type ClientsConfig
- type Config
- type EventBusConfig
- type EventStoreConfig
- type GRPCConfig
- type IdentityStoreConfig
- type LogPublishErrFunc
- type RequestHandler
- func (r RequestHandler) BatchNotifyResourceChanged(ctx context.Context, request *commands.BatchNotifyResourceChangedRequest) (*commands.BatchNotifyResourceChangedResponse, error)
- func (r RequestHandler) CancelPendingCommands(ctx context.Context, request *commands.CancelPendingCommandsRequest) (*commands.CancelPendingCommandsResponse, error)
- func (r RequestHandler) CancelPendingMetadataUpdates(ctx context.Context, request *commands.CancelPendingMetadataUpdatesRequest) (*commands.CancelPendingMetadataUpdatesResponse, error)
- func (r RequestHandler) ConfirmDeviceMetadataUpdate(ctx context.Context, request *commands.ConfirmDeviceMetadataUpdateRequest) (*commands.ConfirmDeviceMetadataUpdateResponse, error)
- func (r RequestHandler) ConfirmResourceCreate(ctx context.Context, request *commands.ConfirmResourceCreateRequest) (*commands.ConfirmResourceCreateResponse, error)
- func (r RequestHandler) ConfirmResourceDelete(ctx context.Context, request *commands.ConfirmResourceDeleteRequest) (*commands.ConfirmResourceDeleteResponse, error)
- func (r RequestHandler) ConfirmResourceRetrieve(ctx context.Context, request *commands.ConfirmResourceRetrieveRequest) (*commands.ConfirmResourceRetrieveResponse, error)
- func (r RequestHandler) ConfirmResourceUpdate(ctx context.Context, request *commands.ConfirmResourceUpdateRequest) (*commands.ConfirmResourceUpdateResponse, error)
- func (r RequestHandler) CreateResource(ctx context.Context, request *commands.CreateResourceRequest) (*commands.CreateResourceResponse, error)
- func (r RequestHandler) DeleteDevices(ctx context.Context, request *commands.DeleteDevicesRequest) (*commands.DeleteDevicesResponse, error)
- func (r RequestHandler) DeleteResource(ctx context.Context, request *commands.DeleteResourceRequest) (*commands.DeleteResourceResponse, error)
- func (r RequestHandler) NotifyResourceChanged(ctx context.Context, request *commands.NotifyResourceChangedRequest) (*commands.NotifyResourceChangedResponse, error)
- func (r RequestHandler) PublishResourceLinks(ctx context.Context, request *commands.PublishResourceLinksRequest) (*commands.PublishResourceLinksResponse, error)
- func (r RequestHandler) RetrieveResource(ctx context.Context, request *commands.RetrieveResourceRequest) (*commands.RetrieveResourceResponse, error)
- func (r RequestHandler) UnpublishResourceLinks(ctx context.Context, request *commands.UnpublishResourceLinksRequest) (*commands.UnpublishResourceLinksResponse, error)
- func (r RequestHandler) UpdateDeviceMetadata(ctx context.Context, request *commands.UpdateDeviceMetadataRequest) (*commands.UpdateDeviceMetadataResponse, error)
- func (r RequestHandler) UpdateResource(ctx context.Context, request *commands.UpdateResourceRequest) (*commands.UpdateResourceResponse, error)
- func (r RequestHandler) UpdateServiceMetadata(ctx context.Context, request *commands.UpdateServiceMetadataRequest) (*commands.UpdateServiceMetadataResponse, error)
- type ResourceAggregateClient
- type ResourceAggregateServer
- type ServiceHeartbeat
- type UnimplementedResourceAggregateServer
- func (UnimplementedResourceAggregateServer) BatchNotifyResourceChanged(context.Context, *commands.BatchNotifyResourceChangedRequest) (*commands.BatchNotifyResourceChangedResponse, error)
- func (UnimplementedResourceAggregateServer) CancelPendingCommands(context.Context, *commands.CancelPendingCommandsRequest) (*commands.CancelPendingCommandsResponse, error)
- func (UnimplementedResourceAggregateServer) CancelPendingMetadataUpdates(context.Context, *commands.CancelPendingMetadataUpdatesRequest) (*commands.CancelPendingMetadataUpdatesResponse, error)
- func (UnimplementedResourceAggregateServer) ConfirmDeviceMetadataUpdate(context.Context, *commands.ConfirmDeviceMetadataUpdateRequest) (*commands.ConfirmDeviceMetadataUpdateResponse, error)
- func (UnimplementedResourceAggregateServer) ConfirmResourceCreate(context.Context, *commands.ConfirmResourceCreateRequest) (*commands.ConfirmResourceCreateResponse, error)
- func (UnimplementedResourceAggregateServer) ConfirmResourceDelete(context.Context, *commands.ConfirmResourceDeleteRequest) (*commands.ConfirmResourceDeleteResponse, error)
- func (UnimplementedResourceAggregateServer) ConfirmResourceRetrieve(context.Context, *commands.ConfirmResourceRetrieveRequest) (*commands.ConfirmResourceRetrieveResponse, error)
- func (UnimplementedResourceAggregateServer) ConfirmResourceUpdate(context.Context, *commands.ConfirmResourceUpdateRequest) (*commands.ConfirmResourceUpdateResponse, error)
- func (UnimplementedResourceAggregateServer) CreateResource(context.Context, *commands.CreateResourceRequest) (*commands.CreateResourceResponse, error)
- func (UnimplementedResourceAggregateServer) DeleteDevices(context.Context, *commands.DeleteDevicesRequest) (*commands.DeleteDevicesResponse, error)
- func (UnimplementedResourceAggregateServer) DeleteResource(context.Context, *commands.DeleteResourceRequest) (*commands.DeleteResourceResponse, error)
- func (UnimplementedResourceAggregateServer) NotifyResourceChanged(context.Context, *commands.NotifyResourceChangedRequest) (*commands.NotifyResourceChangedResponse, error)
- func (UnimplementedResourceAggregateServer) PublishResourceLinks(context.Context, *commands.PublishResourceLinksRequest) (*commands.PublishResourceLinksResponse, error)
- func (UnimplementedResourceAggregateServer) RetrieveResource(context.Context, *commands.RetrieveResourceRequest) (*commands.RetrieveResourceResponse, error)
- func (UnimplementedResourceAggregateServer) UnpublishResourceLinks(context.Context, *commands.UnpublishResourceLinksRequest) (*commands.UnpublishResourceLinksResponse, error)
- func (UnimplementedResourceAggregateServer) UpdateDeviceMetadata(context.Context, *commands.UpdateDeviceMetadataRequest) (*commands.UpdateDeviceMetadataResponse, error)
- func (UnimplementedResourceAggregateServer) UpdateResource(context.Context, *commands.UpdateResourceRequest) (*commands.UpdateResourceResponse, error)
- func (UnimplementedResourceAggregateServer) UpdateServiceMetadata(context.Context, *commands.UpdateServiceMetadataRequest) (*commands.UpdateServiceMetadataResponse, error)
- type UnsafeResourceAggregateServer
- type UpdateServiceMetadataReqResp
- type UpdateServiceMetadataResponseChanData
Constants ¶
const ( ResourceAggregate_PublishResourceLinks_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/PublishResourceLinks" ResourceAggregate_UnpublishResourceLinks_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/UnpublishResourceLinks" ResourceAggregate_NotifyResourceChanged_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/NotifyResourceChanged" ResourceAggregate_UpdateResource_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/UpdateResource" ResourceAggregate_ConfirmResourceUpdate_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/ConfirmResourceUpdate" ResourceAggregate_RetrieveResource_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/RetrieveResource" ResourceAggregate_ConfirmResourceRetrieve_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/ConfirmResourceRetrieve" ResourceAggregate_DeleteResource_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/DeleteResource" ResourceAggregate_ConfirmResourceDelete_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/ConfirmResourceDelete" ResourceAggregate_CreateResource_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/CreateResource" ResourceAggregate_ConfirmResourceCreate_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/ConfirmResourceCreate" ResourceAggregate_UpdateDeviceMetadata_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/UpdateDeviceMetadata" ResourceAggregate_ConfirmDeviceMetadataUpdate_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/ConfirmDeviceMetadataUpdate" ResourceAggregate_CancelPendingMetadataUpdates_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/CancelPendingMetadataUpdates" ResourceAggregate_CancelPendingCommands_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/CancelPendingCommands" ResourceAggregate_DeleteDevices_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/DeleteDevices" ResourceAggregate_BatchNotifyResourceChanged_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/BatchNotifyResourceChanged" ResourceAggregate_UpdateServiceMetadata_FullMethodName = "/resourceaggregate.pb.ResourceAggregate/UpdateServiceMetadata" )
Variables ¶
var ResourceAggregate_ServiceDesc = grpc.ServiceDesc{ ServiceName: "resourceaggregate.pb.ResourceAggregate", HandlerType: (*ResourceAggregateServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "PublishResourceLinks", Handler: _ResourceAggregate_PublishResourceLinks_Handler, }, { MethodName: "UnpublishResourceLinks", Handler: _ResourceAggregate_UnpublishResourceLinks_Handler, }, { MethodName: "NotifyResourceChanged", Handler: _ResourceAggregate_NotifyResourceChanged_Handler, }, { MethodName: "UpdateResource", Handler: _ResourceAggregate_UpdateResource_Handler, }, { MethodName: "ConfirmResourceUpdate", Handler: _ResourceAggregate_ConfirmResourceUpdate_Handler, }, { MethodName: "RetrieveResource", Handler: _ResourceAggregate_RetrieveResource_Handler, }, { MethodName: "ConfirmResourceRetrieve", Handler: _ResourceAggregate_ConfirmResourceRetrieve_Handler, }, { MethodName: "DeleteResource", Handler: _ResourceAggregate_DeleteResource_Handler, }, { MethodName: "ConfirmResourceDelete", Handler: _ResourceAggregate_ConfirmResourceDelete_Handler, }, { MethodName: "CreateResource", Handler: _ResourceAggregate_CreateResource_Handler, }, { MethodName: "ConfirmResourceCreate", Handler: _ResourceAggregate_ConfirmResourceCreate_Handler, }, { MethodName: "UpdateDeviceMetadata", Handler: _ResourceAggregate_UpdateDeviceMetadata_Handler, }, { MethodName: "ConfirmDeviceMetadataUpdate", Handler: _ResourceAggregate_ConfirmDeviceMetadataUpdate_Handler, }, { MethodName: "CancelPendingMetadataUpdates", Handler: _ResourceAggregate_CancelPendingMetadataUpdates_Handler, }, { MethodName: "CancelPendingCommands", Handler: _ResourceAggregate_CancelPendingCommands_Handler, }, { MethodName: "DeleteDevices", Handler: _ResourceAggregate_DeleteDevices_Handler, }, { MethodName: "BatchNotifyResourceChanged", Handler: _ResourceAggregate_BatchNotifyResourceChanged_Handler, }, { MethodName: "UpdateServiceMetadata", Handler: _ResourceAggregate_UpdateServiceMetadata_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "resource-aggregate/pb/service.proto", }
ResourceAggregate_ServiceDesc is the grpc.ServiceDesc for ResourceAggregate service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var ServiceUserID = uuid.NullUUID{Valid: true}.UUID.String()
Functions ¶
func NewDeviceMetadataFactoryModel ¶ added in v2.12.0
func NewDeviceMetadataFactoryModel(userID, owner, hubID string) func(ctx context.Context) (cqrsAggregate.AggregateModel, error)
func NewResourceLinksFactoryModel ¶ added in v2.12.0
func NewResourceLinksFactoryModel(userID, owner, hubID string) func(ctx context.Context) (cqrsAggregate.AggregateModel, error)
func NewResourceStateFactoryModel ¶ added in v2.12.0
func NewResourceStateFactoryModel(userID, owner, hubID string) func(ctx context.Context) (cqrsAggregate.AggregateModel, error)
func NewService ¶
func NewService(ctx context.Context, config Config, fileWatcher *fsnotify.Watcher, logger log.Logger, tracerProvider trace.TracerProvider, eventStore eventstore.EventStore, publisher cqrsEventBus.Publisher) (*service.Service, error)
New creates new Server with provided store and publisher.
func NewServicesMetadataFactoryModel ¶ added in v2.12.0
func NewServicesMetadataFactoryModel(userID, owner, hubID string) func(ctx context.Context) (cqrsAggregate.AggregateModel, error)
func PublishEvents ¶
func RegisterResourceAggregateServer ¶
func RegisterResourceAggregateServer(s grpc.ServiceRegistrar, srv ResourceAggregateServer)
Types ¶
type APIsConfig ¶
type APIsConfig struct {
GRPC GRPCConfig `yaml:"grpc" json:"grpc"`
}
func (*APIsConfig) Validate ¶
func (c *APIsConfig) Validate() error
type Aggregate ¶ added in v2.7.0
type Aggregate struct {
// contains filtered or unexported fields
}
func NewAggregate ¶
func NewAggregate(resourceID *commands.ResourceId, store eventstore.EventStore, factoryModel cqrsAggregate.FactoryModelFunc, retry cqrsAggregate.RetryFunc) (*Aggregate, error)
NewAggregate creates new resource aggreate - it must be created for every run command.
func (*Aggregate) CancelPendingMetadataUpdates ¶ added in v2.7.0
func (a *Aggregate) CancelPendingMetadataUpdates(ctx context.Context, request *commands.CancelPendingMetadataUpdatesRequest) (events []eventstore.Event, err error)
func (*Aggregate) CancelResourceCommand ¶ added in v2.7.0
func (a *Aggregate) CancelResourceCommand(ctx context.Context, request *commands.CancelPendingCommandsRequest) (events []eventstore.Event, err error)
func (*Aggregate) ConfirmDeviceMetadataUpdate ¶ added in v2.7.0
func (a *Aggregate) ConfirmDeviceMetadataUpdate(ctx context.Context, request *commands.ConfirmDeviceMetadataUpdateRequest) (events []eventstore.Event, err error)
func (*Aggregate) ConfirmExpiredServices ¶ added in v2.12.0
func (a *Aggregate) ConfirmExpiredServices(ctx context.Context, request *events.ConfirmExpiredServicesRequest) (events []eventstore.Event, err error)
func (*Aggregate) ConfirmResourceCreate ¶ added in v2.7.0
func (a *Aggregate) ConfirmResourceCreate(ctx context.Context, request *commands.ConfirmResourceCreateRequest) (events []eventstore.Event, err error)
func (*Aggregate) ConfirmResourceDelete ¶ added in v2.7.0
func (a *Aggregate) ConfirmResourceDelete(ctx context.Context, request *commands.ConfirmResourceDeleteRequest) (events []eventstore.Event, err error)
func (*Aggregate) ConfirmResourceRetrieve ¶ added in v2.7.0
func (a *Aggregate) ConfirmResourceRetrieve(ctx context.Context, request *commands.ConfirmResourceRetrieveRequest) (events []eventstore.Event, err error)
func (*Aggregate) ConfirmResourceUpdate ¶ added in v2.7.0
func (a *Aggregate) ConfirmResourceUpdate(ctx context.Context, request *commands.ConfirmResourceUpdateRequest) (events []eventstore.Event, err error)
func (*Aggregate) CreateResource ¶ added in v2.7.0
func (a *Aggregate) CreateResource(ctx context.Context, request *commands.CreateResourceRequest) (events []eventstore.Event, err error)
CreateResource handles a command CreateResource
func (*Aggregate) DeleteResource ¶ added in v2.7.0
func (a *Aggregate) DeleteResource(ctx context.Context, request *commands.DeleteResourceRequest) (events []eventstore.Event, err error)
DeleteResource handles a command DeleteResource
func (*Aggregate) HandleCommand ¶ added in v2.9.0
func (a *Aggregate) HandleCommand(ctx context.Context, cmd cqrsAggregate.Command) ([]eventstore.Event, error)
func (*Aggregate) NotifyResourceChanged ¶ added in v2.7.0
func (a *Aggregate) NotifyResourceChanged(ctx context.Context, request *commands.NotifyResourceChangedRequest) (events []eventstore.Event, err error)
NotifyContentChanged handles a command NotifyContentChanged
func (*Aggregate) PublishResourceLinks ¶ added in v2.7.0
func (a *Aggregate) PublishResourceLinks(ctx context.Context, request *commands.PublishResourceLinksRequest) (events []eventstore.Event, err error)
HandlePublishResource handles a command PublishResourceLinks
func (*Aggregate) ResourceID ¶ added in v2.7.0
func (*Aggregate) RetrieveResource ¶ added in v2.7.0
func (a *Aggregate) RetrieveResource(ctx context.Context, request *commands.RetrieveResourceRequest) (events []eventstore.Event, err error)
RetrieveResource handles a command RetriveResource
func (*Aggregate) UnpublishResourceLinks ¶ added in v2.7.0
func (a *Aggregate) UnpublishResourceLinks(ctx context.Context, request *commands.UnpublishResourceLinksRequest) (events []eventstore.Event, err error)
HandleUnpublishResource handles a command UnpublishResourceLinks
func (*Aggregate) UpdateDeviceMetadata ¶ added in v2.7.0
func (a *Aggregate) UpdateDeviceMetadata(ctx context.Context, request *commands.UpdateDeviceMetadataRequest) (events []eventstore.Event, err error)
func (*Aggregate) UpdateDeviceToOffline ¶ added in v2.12.0
func (a *Aggregate) UpdateDeviceToOffline(ctx context.Context, request *events.UpdateDeviceToOfflineRequest) (events []eventstore.Event, err error)
func (*Aggregate) UpdateResource ¶ added in v2.7.0
func (a *Aggregate) UpdateResource(ctx context.Context, request *commands.UpdateResourceRequest) (events []eventstore.Event, err error)
HandleUpdateResourceContent handles a command UpdateResource
func (*Aggregate) UpdateServiceMetadata ¶ added in v2.12.0
func (a *Aggregate) UpdateServiceMetadata(ctx context.Context, request *commands.UpdateServiceMetadataRequest) (events []eventstore.Event, err error)
type ClientsConfig ¶
type ClientsConfig struct { Eventbus EventBusConfig `yaml:"eventBus" json:"eventBus"` Eventstore EventStoreConfig `yaml:"eventStore" json:"eventStore"` IdentityStore IdentityStoreConfig `yaml:"identityStore" json:"identityStore"` OpenTelemetryCollector otelClient.Config `yaml:"openTelemetryCollector" json:"openTelemetryCollector"` }
func (*ClientsConfig) Validate ¶
func (c *ClientsConfig) Validate() error
type Config ¶
type Config struct { HubID string `yaml:"hubID" json:"hubId"` Log log.Config `yaml:"log" json:"log"` APIs APIsConfig `yaml:"apis" json:"apis"` Clients ClientsConfig `yaml:"clients" json:"clients"` }
Config represent application configuration
type EventBusConfig ¶
type EventBusConfig struct {
NATS natsClient.ConfigPublisher `yaml:"nats" json:"nats"`
}
func (*EventBusConfig) Validate ¶
func (c *EventBusConfig) Validate() error
type EventStoreConfig ¶
type EventStoreConfig struct { ConcurrencyExceptionMaxRetry int `yaml:"occMaxRetry" json:"occMaxRetry"` DefaultCommandTimeToLive time.Duration `yaml:"defaultCommandTimeToLive" json:"defaultCommandTimeToLive"` Connection eventstoreConfig.Config `yaml:",inline" json:",inline"` }
func (*EventStoreConfig) Validate ¶
func (c *EventStoreConfig) Validate() error
type GRPCConfig ¶
type GRPCConfig struct { OwnerCacheExpiration time.Duration `yaml:"ownerCacheExpiration" json:"ownerCacheExpiration"` grpcServer.Config `yaml:",inline" json:",inline"` }
func (*GRPCConfig) Validate ¶
func (c *GRPCConfig) Validate() error
type IdentityStoreConfig ¶
func (*IdentityStoreConfig) Validate ¶
func (c *IdentityStoreConfig) Validate() error
type LogPublishErrFunc ¶
type LogPublishErrFunc func(err error)
type RequestHandler ¶
type RequestHandler struct { UnimplementedResourceAggregateServer // contains filtered or unexported fields }
RequestHandler for handling incoming request
func NewRequestHandler ¶
func NewRequestHandler(config Config, eventstore eventstore.EventStore, publisher eventbus.Publisher, getOwnerDevicesFunc getOwnerDevicesFunc, serviceHeartbeat *ServiceHeartbeat, logger log.Logger) *RequestHandler
NewRequestHandler factory for new RequestHandler
func (RequestHandler) BatchNotifyResourceChanged ¶ added in v2.6.0
func (r RequestHandler) BatchNotifyResourceChanged(ctx context.Context, request *commands.BatchNotifyResourceChangedRequest) (*commands.BatchNotifyResourceChangedResponse, error)
func (RequestHandler) CancelPendingCommands ¶
func (r RequestHandler) CancelPendingCommands(ctx context.Context, request *commands.CancelPendingCommandsRequest) (*commands.CancelPendingCommandsResponse, error)
func (RequestHandler) CancelPendingMetadataUpdates ¶
func (r RequestHandler) CancelPendingMetadataUpdates(ctx context.Context, request *commands.CancelPendingMetadataUpdatesRequest) (*commands.CancelPendingMetadataUpdatesResponse, error)
func (RequestHandler) ConfirmDeviceMetadataUpdate ¶
func (r RequestHandler) ConfirmDeviceMetadataUpdate(ctx context.Context, request *commands.ConfirmDeviceMetadataUpdateRequest) (*commands.ConfirmDeviceMetadataUpdateResponse, error)
func (RequestHandler) ConfirmResourceCreate ¶
func (r RequestHandler) ConfirmResourceCreate(ctx context.Context, request *commands.ConfirmResourceCreateRequest) (*commands.ConfirmResourceCreateResponse, error)
func (RequestHandler) ConfirmResourceDelete ¶
func (r RequestHandler) ConfirmResourceDelete(ctx context.Context, request *commands.ConfirmResourceDeleteRequest) (*commands.ConfirmResourceDeleteResponse, error)
func (RequestHandler) ConfirmResourceRetrieve ¶
func (r RequestHandler) ConfirmResourceRetrieve(ctx context.Context, request *commands.ConfirmResourceRetrieveRequest) (*commands.ConfirmResourceRetrieveResponse, error)
func (RequestHandler) ConfirmResourceUpdate ¶
func (r RequestHandler) ConfirmResourceUpdate(ctx context.Context, request *commands.ConfirmResourceUpdateRequest) (*commands.ConfirmResourceUpdateResponse, error)
func (RequestHandler) CreateResource ¶
func (r RequestHandler) CreateResource(ctx context.Context, request *commands.CreateResourceRequest) (*commands.CreateResourceResponse, error)
func (RequestHandler) DeleteDevices ¶
func (r RequestHandler) DeleteDevices(ctx context.Context, request *commands.DeleteDevicesRequest) (*commands.DeleteDevicesResponse, error)
Delete documents from events database for devices selected by query
Using empty deviceIdFilter in DeleteDevicesRequest is interpreting as requesting to delete all documents for devices owned by the user.
Function returns error or a non-empty DeleteDevicesResponse message, where the DeviceIds field is filled with list of device ids. The list is an intersection of the list provided by DeleteDevicesRequest and device ids owned by the user (ie. from the original list of device ids it filters out devices that are not owned by the user).
func (RequestHandler) DeleteResource ¶
func (r RequestHandler) DeleteResource(ctx context.Context, request *commands.DeleteResourceRequest) (*commands.DeleteResourceResponse, error)
func (RequestHandler) NotifyResourceChanged ¶
func (r RequestHandler) NotifyResourceChanged(ctx context.Context, request *commands.NotifyResourceChangedRequest) (*commands.NotifyResourceChangedResponse, error)
func (RequestHandler) PublishResourceLinks ¶
func (r RequestHandler) PublishResourceLinks(ctx context.Context, request *commands.PublishResourceLinksRequest) (*commands.PublishResourceLinksResponse, error)
func (RequestHandler) RetrieveResource ¶
func (r RequestHandler) RetrieveResource(ctx context.Context, request *commands.RetrieveResourceRequest) (*commands.RetrieveResourceResponse, error)
func (RequestHandler) UnpublishResourceLinks ¶
func (r RequestHandler) UnpublishResourceLinks(ctx context.Context, request *commands.UnpublishResourceLinksRequest) (*commands.UnpublishResourceLinksResponse, error)
func (RequestHandler) UpdateDeviceMetadata ¶
func (r RequestHandler) UpdateDeviceMetadata(ctx context.Context, request *commands.UpdateDeviceMetadataRequest) (*commands.UpdateDeviceMetadataResponse, error)
func (RequestHandler) UpdateResource ¶
func (r RequestHandler) UpdateResource(ctx context.Context, request *commands.UpdateResourceRequest) (*commands.UpdateResourceResponse, error)
func (RequestHandler) UpdateServiceMetadata ¶ added in v2.12.0
func (r RequestHandler) UpdateServiceMetadata(ctx context.Context, request *commands.UpdateServiceMetadataRequest) (*commands.UpdateServiceMetadataResponse, error)
type ResourceAggregateClient ¶
type ResourceAggregateClient interface { PublishResourceLinks(ctx context.Context, in *commands.PublishResourceLinksRequest, opts ...grpc.CallOption) (*commands.PublishResourceLinksResponse, error) UnpublishResourceLinks(ctx context.Context, in *commands.UnpublishResourceLinksRequest, opts ...grpc.CallOption) (*commands.UnpublishResourceLinksResponse, error) NotifyResourceChanged(ctx context.Context, in *commands.NotifyResourceChangedRequest, opts ...grpc.CallOption) (*commands.NotifyResourceChangedResponse, error) UpdateResource(ctx context.Context, in *commands.UpdateResourceRequest, opts ...grpc.CallOption) (*commands.UpdateResourceResponse, error) ConfirmResourceUpdate(ctx context.Context, in *commands.ConfirmResourceUpdateRequest, opts ...grpc.CallOption) (*commands.ConfirmResourceUpdateResponse, error) RetrieveResource(ctx context.Context, in *commands.RetrieveResourceRequest, opts ...grpc.CallOption) (*commands.RetrieveResourceResponse, error) ConfirmResourceRetrieve(ctx context.Context, in *commands.ConfirmResourceRetrieveRequest, opts ...grpc.CallOption) (*commands.ConfirmResourceRetrieveResponse, error) DeleteResource(ctx context.Context, in *commands.DeleteResourceRequest, opts ...grpc.CallOption) (*commands.DeleteResourceResponse, error) ConfirmResourceDelete(ctx context.Context, in *commands.ConfirmResourceDeleteRequest, opts ...grpc.CallOption) (*commands.ConfirmResourceDeleteResponse, error) CreateResource(ctx context.Context, in *commands.CreateResourceRequest, opts ...grpc.CallOption) (*commands.CreateResourceResponse, error) ConfirmResourceCreate(ctx context.Context, in *commands.ConfirmResourceCreateRequest, opts ...grpc.CallOption) (*commands.ConfirmResourceCreateResponse, error) UpdateDeviceMetadata(ctx context.Context, in *commands.UpdateDeviceMetadataRequest, opts ...grpc.CallOption) (*commands.UpdateDeviceMetadataResponse, error) ConfirmDeviceMetadataUpdate(ctx context.Context, in *commands.ConfirmDeviceMetadataUpdateRequest, opts ...grpc.CallOption) (*commands.ConfirmDeviceMetadataUpdateResponse, error) CancelPendingMetadataUpdates(ctx context.Context, in *commands.CancelPendingMetadataUpdatesRequest, opts ...grpc.CallOption) (*commands.CancelPendingMetadataUpdatesResponse, error) CancelPendingCommands(ctx context.Context, in *commands.CancelPendingCommandsRequest, opts ...grpc.CallOption) (*commands.CancelPendingCommandsResponse, error) DeleteDevices(ctx context.Context, in *commands.DeleteDevicesRequest, opts ...grpc.CallOption) (*commands.DeleteDevicesResponse, error) BatchNotifyResourceChanged(ctx context.Context, in *commands.BatchNotifyResourceChangedRequest, opts ...grpc.CallOption) (*commands.BatchNotifyResourceChangedResponse, error) // Service management // This command is used to update the status of the service. It doesn't validate JWT token. UpdateServiceMetadata(ctx context.Context, in *commands.UpdateServiceMetadataRequest, opts ...grpc.CallOption) (*commands.UpdateServiceMetadataResponse, error) }
ResourceAggregateClient is the client API for ResourceAggregate service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewResourceAggregateClient ¶
func NewResourceAggregateClient(cc grpc.ClientConnInterface) ResourceAggregateClient
type ResourceAggregateServer ¶
type ResourceAggregateServer interface { PublishResourceLinks(context.Context, *commands.PublishResourceLinksRequest) (*commands.PublishResourceLinksResponse, error) UnpublishResourceLinks(context.Context, *commands.UnpublishResourceLinksRequest) (*commands.UnpublishResourceLinksResponse, error) NotifyResourceChanged(context.Context, *commands.NotifyResourceChangedRequest) (*commands.NotifyResourceChangedResponse, error) UpdateResource(context.Context, *commands.UpdateResourceRequest) (*commands.UpdateResourceResponse, error) ConfirmResourceUpdate(context.Context, *commands.ConfirmResourceUpdateRequest) (*commands.ConfirmResourceUpdateResponse, error) RetrieveResource(context.Context, *commands.RetrieveResourceRequest) (*commands.RetrieveResourceResponse, error) ConfirmResourceRetrieve(context.Context, *commands.ConfirmResourceRetrieveRequest) (*commands.ConfirmResourceRetrieveResponse, error) DeleteResource(context.Context, *commands.DeleteResourceRequest) (*commands.DeleteResourceResponse, error) ConfirmResourceDelete(context.Context, *commands.ConfirmResourceDeleteRequest) (*commands.ConfirmResourceDeleteResponse, error) CreateResource(context.Context, *commands.CreateResourceRequest) (*commands.CreateResourceResponse, error) ConfirmResourceCreate(context.Context, *commands.ConfirmResourceCreateRequest) (*commands.ConfirmResourceCreateResponse, error) UpdateDeviceMetadata(context.Context, *commands.UpdateDeviceMetadataRequest) (*commands.UpdateDeviceMetadataResponse, error) ConfirmDeviceMetadataUpdate(context.Context, *commands.ConfirmDeviceMetadataUpdateRequest) (*commands.ConfirmDeviceMetadataUpdateResponse, error) CancelPendingMetadataUpdates(context.Context, *commands.CancelPendingMetadataUpdatesRequest) (*commands.CancelPendingMetadataUpdatesResponse, error) CancelPendingCommands(context.Context, *commands.CancelPendingCommandsRequest) (*commands.CancelPendingCommandsResponse, error) DeleteDevices(context.Context, *commands.DeleteDevicesRequest) (*commands.DeleteDevicesResponse, error) BatchNotifyResourceChanged(context.Context, *commands.BatchNotifyResourceChangedRequest) (*commands.BatchNotifyResourceChangedResponse, error) // Service management // This command is used to update the status of the service. It doesn't validate JWT token. UpdateServiceMetadata(context.Context, *commands.UpdateServiceMetadataRequest) (*commands.UpdateServiceMetadataResponse, error) // contains filtered or unexported methods }
ResourceAggregateServer is the server API for ResourceAggregate service. All implementations must embed UnimplementedResourceAggregateServer for forward compatibility
type ServiceHeartbeat ¶ added in v2.12.0
type ServiceHeartbeat struct {
// contains filtered or unexported fields
}
func NewServiceHeartbeat ¶ added in v2.12.0
func NewServiceHeartbeat(config Config, eventstore eventstore.EventStore, publisher eventbus.Publisher, logger log.Logger) *ServiceHeartbeat
func (*ServiceHeartbeat) Close ¶ added in v2.12.0
func (s *ServiceHeartbeat) Close()
func (*ServiceHeartbeat) ProcessRequest ¶ added in v2.12.0
func (s *ServiceHeartbeat) ProcessRequest(r UpdateServiceMetadataReqResp) error
type UnimplementedResourceAggregateServer ¶
type UnimplementedResourceAggregateServer struct { }
UnimplementedResourceAggregateServer must be embedded to have forward compatible implementations.
func (UnimplementedResourceAggregateServer) BatchNotifyResourceChanged ¶ added in v2.6.0
func (UnimplementedResourceAggregateServer) BatchNotifyResourceChanged(context.Context, *commands.BatchNotifyResourceChangedRequest) (*commands.BatchNotifyResourceChangedResponse, error)
func (UnimplementedResourceAggregateServer) CancelPendingCommands ¶
func (UnimplementedResourceAggregateServer) CancelPendingCommands(context.Context, *commands.CancelPendingCommandsRequest) (*commands.CancelPendingCommandsResponse, error)
func (UnimplementedResourceAggregateServer) CancelPendingMetadataUpdates ¶
func (UnimplementedResourceAggregateServer) CancelPendingMetadataUpdates(context.Context, *commands.CancelPendingMetadataUpdatesRequest) (*commands.CancelPendingMetadataUpdatesResponse, error)
func (UnimplementedResourceAggregateServer) ConfirmDeviceMetadataUpdate ¶
func (UnimplementedResourceAggregateServer) ConfirmDeviceMetadataUpdate(context.Context, *commands.ConfirmDeviceMetadataUpdateRequest) (*commands.ConfirmDeviceMetadataUpdateResponse, error)
func (UnimplementedResourceAggregateServer) ConfirmResourceCreate ¶
func (UnimplementedResourceAggregateServer) ConfirmResourceCreate(context.Context, *commands.ConfirmResourceCreateRequest) (*commands.ConfirmResourceCreateResponse, error)
func (UnimplementedResourceAggregateServer) ConfirmResourceDelete ¶
func (UnimplementedResourceAggregateServer) ConfirmResourceDelete(context.Context, *commands.ConfirmResourceDeleteRequest) (*commands.ConfirmResourceDeleteResponse, error)
func (UnimplementedResourceAggregateServer) ConfirmResourceRetrieve ¶
func (UnimplementedResourceAggregateServer) ConfirmResourceRetrieve(context.Context, *commands.ConfirmResourceRetrieveRequest) (*commands.ConfirmResourceRetrieveResponse, error)
func (UnimplementedResourceAggregateServer) ConfirmResourceUpdate ¶
func (UnimplementedResourceAggregateServer) ConfirmResourceUpdate(context.Context, *commands.ConfirmResourceUpdateRequest) (*commands.ConfirmResourceUpdateResponse, error)
func (UnimplementedResourceAggregateServer) CreateResource ¶
func (UnimplementedResourceAggregateServer) CreateResource(context.Context, *commands.CreateResourceRequest) (*commands.CreateResourceResponse, error)
func (UnimplementedResourceAggregateServer) DeleteDevices ¶
func (UnimplementedResourceAggregateServer) DeleteDevices(context.Context, *commands.DeleteDevicesRequest) (*commands.DeleteDevicesResponse, error)
func (UnimplementedResourceAggregateServer) DeleteResource ¶
func (UnimplementedResourceAggregateServer) DeleteResource(context.Context, *commands.DeleteResourceRequest) (*commands.DeleteResourceResponse, error)
func (UnimplementedResourceAggregateServer) NotifyResourceChanged ¶
func (UnimplementedResourceAggregateServer) NotifyResourceChanged(context.Context, *commands.NotifyResourceChangedRequest) (*commands.NotifyResourceChangedResponse, error)
func (UnimplementedResourceAggregateServer) PublishResourceLinks ¶
func (UnimplementedResourceAggregateServer) PublishResourceLinks(context.Context, *commands.PublishResourceLinksRequest) (*commands.PublishResourceLinksResponse, error)
func (UnimplementedResourceAggregateServer) RetrieveResource ¶
func (UnimplementedResourceAggregateServer) RetrieveResource(context.Context, *commands.RetrieveResourceRequest) (*commands.RetrieveResourceResponse, error)
func (UnimplementedResourceAggregateServer) UnpublishResourceLinks ¶
func (UnimplementedResourceAggregateServer) UnpublishResourceLinks(context.Context, *commands.UnpublishResourceLinksRequest) (*commands.UnpublishResourceLinksResponse, error)
func (UnimplementedResourceAggregateServer) UpdateDeviceMetadata ¶
func (UnimplementedResourceAggregateServer) UpdateDeviceMetadata(context.Context, *commands.UpdateDeviceMetadataRequest) (*commands.UpdateDeviceMetadataResponse, error)
func (UnimplementedResourceAggregateServer) UpdateResource ¶
func (UnimplementedResourceAggregateServer) UpdateResource(context.Context, *commands.UpdateResourceRequest) (*commands.UpdateResourceResponse, error)
func (UnimplementedResourceAggregateServer) UpdateServiceMetadata ¶ added in v2.12.0
func (UnimplementedResourceAggregateServer) UpdateServiceMetadata(context.Context, *commands.UpdateServiceMetadataRequest) (*commands.UpdateServiceMetadataResponse, error)
type UnsafeResourceAggregateServer ¶
type UnsafeResourceAggregateServer interface {
// contains filtered or unexported methods
}
UnsafeResourceAggregateServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ResourceAggregateServer will result in compilation errors.
type UpdateServiceMetadataReqResp ¶ added in v2.12.0
type UpdateServiceMetadataReqResp struct { Request *commands.UpdateServiceMetadataRequest ResponseChan chan UpdateServiceMetadataResponseChanData }
type UpdateServiceMetadataResponseChanData ¶ added in v2.12.0
type UpdateServiceMetadataResponseChanData struct { Response *commands.UpdateServiceMetadataResponse Err error }