sinks

package
v0.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const MetadataLabelOtel = "opentelemetry"

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")

	ErrUnauthorizedAccess = errors.New("missing or invalid credentials provided")

	ErrRemoveEntity = errors.New("failed to remove entity")

	ErrInvalidBackend = errors.New("No available backends")
)
View Source
var (
	ErrCreateSink                 = errors.New("failed to create Sink")
	ErrConflictSink               = errors.New("entity already exists")
	ErrUnsupportedContentTypeSink = errors.New("unsupported content type")
	ErrValidateSink               = errors.New("failed to validate Sink")
)

Functions

This section is empty.

Types

type Configuration added in v0.26.0

type Configuration struct {
	Exporter       backend.Backend                        `json:"exporter" ,yaml:"exporter"`
	Authentication authentication_type.AuthenticationType `json:"authentication" ,yaml:"authentication"`
}

func NewConfigBackends added in v0.26.0

type Filter

type Filter struct {
	StateFilter string
}

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 Sink

type Sink struct {
	ID          string
	Name        types.Identifier
	MFOwnerID   string
	Description *string
	Backend     string
	Config      types.Metadata
	Format      string
	ConfigData  string
	Tags        types.Tags
	State       State
	Error       string
	Created     time.Time
}

func (*Sink) GetAuthenticationTypeName added in v0.26.0

func (s *Sink) GetAuthenticationTypeName() string

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
	// RetrieveAllByOwnerID retrieves Sinks by OwnerID
	RetrieveAllByOwnerID(ctx context.Context, owner string, pm PageMetadata) (Page, error)
	// SearchAllSinks search Sinks for internal usage like services
	SearchAllSinks(ctx context.Context, filter Filter) ([]Sink, error)
	// RetrieveById retrieves a Sink by ID
	RetrieveById(ctx context.Context, key string) (Sink, error)
	// RetrieveByOwnerAndId retrieves a By OwnerId And SinkId
	RetrieveByOwnerAndId(ctx context.Context, ownerID string, key string) (Sink, error)
	// Remove an existing Sink by id
	Remove(ctx context.Context, owner string, key string) error
	// UpdateSinkState updates sink state like active, idle, new, unknown
	UpdateSinkState(ctx context.Context, sinkID string, msg string, ownerID string, state State) error
	// GetVersion for migrate service
	GetVersion(ctx context.Context) (string, error)
	// UpsertVersion for migrate service
	UpdateVersion(ctx context.Context, version string) 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) (Sink, error)
	// UpdateSinkInternal by id
	UpdateSinkInternal(ctx context.Context, s Sink) (Sink, error)
	// ListSinks retrieves data about sinks
	ListSinks(ctx context.Context, token string, pm PageMetadata) (Page, error)
	// ListSinksInternal retrieves data from sinks filtered by SinksFilter for Services like Maestro, to build DeploymentEntries
	ListSinksInternal(ctx context.Context, filter Filter) (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)
	// ListAuthenticationTypes retrieves a list of available AuthenticationTypes
	ListAuthenticationTypes(ctx context.Context, token string) ([]authentication_type.AuthenticationTypeConfig, error)
	// ViewAuthenticationType retrieves a AuthenticationType by the name
	ViewAuthenticationType(ctx context.Context, token string, key string) (authentication_type.AuthenticationTypeConfig, error)
	// ViewSink retrieves a sink by id, for View, does not send password
	ViewSink(ctx context.Context, token string, key string) (Sink, error)
	// ViewSinkInternal retrieves a sink by id, via GRPC, sends password
	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)
	// ChangeSinkStateInternal change the sink internal state from new/idle/active
	ChangeSinkStateInternal(ctx context.Context, sinkID string, msg string, ownerID string, state State) error
	// GetLogger gets service logger to log within gokit's packages
	GetLogger() *zap.Logger
}

SinkService Sink CRUD interface

func NewSinkService

func NewSinkService(logger *zap.Logger, auth mainflux.AuthServiceClient, sinkRepo SinkRepository, mfsdk mfsdk.SDK, passwordService authentication_type.PasswordService) SinkService

type State

type State int
const (
	Unknown State = iota
	Active
	Error
	Idle
	Warning
	Provisioning
	ProvisioningError
)

func NewStateFromString added in v0.29.0

func NewStateFromString(state string) State

func (*State) Scan

func (s *State) Scan(value interface{}) error

func (State) String

func (s State) String() string

func (State) Value

func (s State) Value() (driver.Value, error)

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.
consumer
Package esconsumer contains events esconsumer for events
Package esconsumer contains events esconsumer for events
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL