Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrMalformedEntity indicates malformed entity specification (e.g. // invalid username or password). ErrMalformedEntity = errors.New("malformed entity specification") // ErrNotFound indicates a non-existent entity request. ErrNotFound = errors.New("non-existent entity") // ErrConflict indicates that entity already exists. ErrConflict = errors.New("entity already exists") // ErrScanMetadata indicates problem with metadata in db ErrScanMetadata = errors.New("failed to scan metadata in db") // ErrSelectEntity indicates error while reading entity from database ErrSelectEntity = errors.New("select entity from db error") // ErrEntityConnected indicates error while checking connection in database ErrEntityConnected = errors.New("check connection in database error") // ErrUpdateEntity indicates error while updating a entity ErrUpdateEntity = errors.New("failed to update entity") ErrRemoveEntity = errors.New("failed to remove entity") ErrInvalidBackend = errors.New("No available backends") )
Functions ¶
This section is empty.
Types ¶
type Page ¶
type Page struct {
PageMetadata
Sinks []Sink
}
Page contains page related metadata as well as list of sinks that belong to this page
type PageMetadata ¶
type PageMetadata struct {
Total uint64
Offset uint64 `json:"offset,omitempty"`
Limit uint64 `json:"limit,omitempty"`
Name string `json:"name,omitempty"`
Order string `json:"order,omitempty"`
Dir string `json:"dir,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
Tags types.Tags `json:"tags,omitempty"`
}
PageMetadata contains page metadata that helps navigation
type SinkRepository ¶
type SinkRepository interface {
// Save persists the Sink. Successful operation is indicated by non-nil
// error response.
Save(ctx context.Context, sink Sink) (string, error)
// Update performs an update to the existing sink, A non-nil error is
// returned to indicate operation failure
Update(ctx context.Context, sink Sink) error
// RetrieveAll retrieves Sinks
RetrieveAll(ctx context.Context, owner string, pm PageMetadata) (Page, error)
// RetrieveById retrieves a Sink by Id
RetrieveById(ctx context.Context, key string) (Sink, error)
// RetrieveById retrieves a Sink by Id
RetrieveByOwnerAndId(ctx context.Context, ownerID string, key string) (Sink, error)
// Remove a existing Sink by id
Remove(ctx context.Context, owner string, key string) error
// UpdateSinkState
UpdateSinkState(ctx context.Context, sinkID string, msg string, ownerID string, state State) error
}
type SinkService ¶
type SinkService interface {
// CreateSink creates new data sink
CreateSink(ctx context.Context, token string, s Sink) (Sink, error)
// UpdateSink by id
UpdateSink(ctx context.Context, token string, s Sink) error
// ListSinks retrieves data about sinks
ListSinks(ctx context.Context, token string, pm PageMetadata) (Page, error)
// ListBackends retrieves a list of available backends
ListBackends(ctx context.Context, token string) ([]string, error)
// ViewBackend retrieves a backend by the name
ViewBackend(ctx context.Context, token string, key string) (backend.Backend, error)
// ViewSink retrieves a sink by id
ViewSink(ctx context.Context, token string, key string) (Sink, error)
// ViewSink retrieves a sink by id
ViewSinkInternal(ctx context.Context, ownerID string, key string) (Sink, error)
// DeleteSink delete a existing sink by id
DeleteSink(ctx context.Context, token string, key string) error
// ValidateSink validate a sink configuration without saving
ValidateSink(ctx context.Context, token string, sink Sink) (Sink, error)
// ChangeState
ChangeSinkStateInternal(ctx context.Context, sinkID string, msg string, ownerID string, state State) error
}
SinkService Sink CRUD interface
func NewSinkService ¶
func NewSinkService(logger *zap.Logger, auth mainflux.AuthServiceClient, sinkRepo SinkRepository, mfsdk mfsdk.SDK) SinkService
Directories
¶
| Path | Synopsis |
|---|---|
|
api
|
|
|
Package postgres contains repository implementations using PostgreSQL as the underlying database.
|
Package postgres contains repository implementations using PostgreSQL as the underlying database. |
|
redis
|
|
|
consumer
Package esconsumer contains events esconsumer for events Adapted for Orb project, modifications licensed under MPL v.
|
Package esconsumer contains events esconsumer for events Adapted for Orb project, modifications licensed under MPL v. |
|
producer
Package producer contains the domain events needed to support event sourcing of Sink service actions.
|
Package producer contains the domain events needed to support event sourcing of Sink service actions. |
Click to show internal directories.
Click to hide internal directories.