Documentation
¶
Index ¶
- Variables
- type DBType
- type Database
- type DefaultListener
- type InterServiceMessage
- type Listener
- type MessageCode
- type Permissions
- type Service
- type ServiceInitializationInformation
- func (s *ServiceInitializationInformation) AcceptMessage() InterServiceMessage
- func (s *ServiceInitializationInformation) AwaitISMessage(id uuid.UUID, timeout time.Duration) (InterServiceMessage, error)
- func (s *ServiceInitializationInformation) GetDatabase() (Database, error)
- func (s *ServiceInitializationInformation) SendAndAwaitISMessage(forService uuid.UUID, messageType MessageCode, message any, ...) (InterServiceMessage, error)
- func (s *ServiceInitializationInformation) SendISMessage(forService uuid.UUID, messageType MessageCode, message any) uuid.UUID
- func (s *ServiceInitializationInformation) StartISProcessor()
- func (s *ServiceInitializationInformation) YesIAbsolutelyKnowWhatIAmDoingAndIWantToAccessTheRawInbox() <-chan InterServiceMessage
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrTimeout = errors.New("timeout")
)
Functions ¶
This section is empty.
Types ¶
type DefaultListener ¶ added in v3.1.0
type DefaultListener <-chan InterServiceMessage
func (DefaultListener) AcceptMessage ¶ added in v3.1.0
func (l DefaultListener) AcceptMessage() InterServiceMessage
type InterServiceMessage ¶
type InterServiceMessage struct { MessageID uuid.UUID `validate:"required"` ServiceID uuid.UUID `validate:"required"` ForServiceID uuid.UUID `validate:"required"` MessageType MessageCode `validate:"required"` SentAt time.Time `validate:"required"` Message any `validate:"required"` }
func (*InterServiceMessage) Respond ¶ added in v3.5.0
func (s *InterServiceMessage) Respond(messageType MessageCode, message any, information *ServiceInitializationInformation)
type Listener ¶ added in v3.1.0
type Listener interface {
AcceptMessage() InterServiceMessage
}
func NewListener ¶ added in v3.1.0
func NewListener(c <-chan InterServiceMessage) Listener
type MessageCode ¶ added in v3.1.0
type MessageCode int
const ( Success MessageCode = iota BadRequest InternalError )
type Permissions ¶
type Permissions struct { // Authenticate allows the service to register with the nucleus authentication service and use OAuth2 Authenticate bool `validate:"required"` // Router allows the service to serve web pages Router bool `validate:"required"` // Database allows the service to ask for a centralised database connection Database bool `validate:"required"` // BlobStorage allows the service to use the blob storage service BlobStorage bool `validate:"required"` // InterServiceCommunication allows the service to send and receive messages from other services InterServiceCommunication bool `validate:"required"` // Resources allows the service to access their resource directory Resources bool `validate:"required"` }
type Service ¶
type Service struct { Name string `validate:"required"` Permissions Permissions `validate:"required"` ServiceID uuid.UUID `validate:"required"` }
type ServiceInitializationInformation ¶
type ServiceInitializationInformation struct { Service *Service `validate:"required"` Domain *string Outbox chan<- InterServiceMessage `validate:"required"` Router *chi.Mux Configuration map[string]interface{} ResourceDir fs.FS // contains filtered or unexported fields }
func NewServiceInitializationInformation ¶ added in v3.1.0
func NewServiceInitializationInformation(domain *string, outbox chan<- InterServiceMessage, inbox <-chan InterServiceMessage, router *chi.Mux, configuration map[string]interface{}, resourceDir fs.FS) *ServiceInitializationInformation
NewServiceInitializationInformation creates a new ServiceInitializationInformation and is only ever meant to be called by fulgens or a compliant implementation of fulgens.
func (*ServiceInitializationInformation) AcceptMessage ¶ added in v3.4.0
func (s *ServiceInitializationInformation) AcceptMessage() InterServiceMessage
func (*ServiceInitializationInformation) AwaitISMessage ¶ added in v3.6.0
func (s *ServiceInitializationInformation) AwaitISMessage(id uuid.UUID, timeout time.Duration) (InterServiceMessage, error)
func (*ServiceInitializationInformation) GetDatabase ¶ added in v3.1.0
func (s *ServiceInitializationInformation) GetDatabase() (Database, error)
func (*ServiceInitializationInformation) SendAndAwaitISMessage ¶
func (s *ServiceInitializationInformation) SendAndAwaitISMessage(forService uuid.UUID, messageType MessageCode, message any, timeout time.Duration) (InterServiceMessage, error)
func (*ServiceInitializationInformation) SendISMessage ¶
func (s *ServiceInitializationInformation) SendISMessage(forService uuid.UUID, messageType MessageCode, message any) uuid.UUID
func (*ServiceInitializationInformation) StartISProcessor ¶ added in v3.1.0
func (s *ServiceInitializationInformation) StartISProcessor()
func (*ServiceInitializationInformation) YesIAbsolutelyKnowWhatIAmDoingAndIWantToAccessTheRawInbox ¶ added in v3.1.0
func (s *ServiceInitializationInformation) YesIAbsolutelyKnowWhatIAmDoingAndIWantToAccessTheRawInbox() <-chan InterServiceMessage
YesIAbsolutelyKnowWhatIAmDoingAndIWantToAccessTheRawInbox returns a channel that can be used to read messages from the inbox. This is a dangerous operation, can and will break the buffer, and you should most absolutely not use this unless you would like to handle the messages yourself with no outside help or synchronization.
If you think you know what you're doing, **you probably don't**.
Click to show internal directories.
Click to hide internal directories.