rprt

package
v0.0.0-...-74f9961 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory interface {
	CreateRedialSleepTime() time.Duration
	CreateLog(Stream) (Log, error)
	CreateStream(brokers []string, r Rprt) (Stream, error)
	CreateUserMethods() (UserMethods, error)
	CreateUsers(UserMethods, Factory) (Users, error)
	CreateUser(login string, membership Membership, rights []Rights) (User, error)
	CreateReports() (Reports, error)
}

Factory provides the interface to create rprt-service object instances.

func CreateFactory

func CreateFactory() Factory

CreateFactory creates an instance of Factory interface.

type Group

type Group struct {
	Domain string
	Name   string
}

Group describes group entity.

type Log

type Log interface {
	// Close closes the service.
	Close()

	// Subscribe creates a subscription to log-messages.
	Subscribe() (LogSubscription, error)

	// Fatal formats and sends error message in the queue and prints to the standard logger and calls to os.Exit(1).
	Fatal(format string, args ...interface{})
	// Error formats and sends error message in the queue and prints to the standard logger.
	Error(format string, args ...interface{})
	// Warn formats and sends warning message in the queue and prints to the standard logger.
	Warn(format string, args ...interface{})
	// Info formats and sends information message in the queue and prints to the standard logger.
	Info(format string, args ...interface{})
	// Debug formats and sends debug message in the queue and prints to the standard logger.
	Debug(format string, args ...interface{})
}

Log represents logger service.

type LogRecord

type LogRecord interface {
	// GetSequenceNumber returns record sequence number.
	GetSequenceNumber() int64
	// GetTime returns record time.
	GetTime() time.Time
	// GetText returns record text.
	GetText() string
	// GetSeverity returns record severity.
	GetSeverity() string
	// GetNodeType returns author node type name.
	GetNodeType() string
	// GetNodeName returns author node instance name.
	GetNodeName() string
}

LogRecord represents log-record delivered from a queue.

type LogSubscription

type LogSubscription interface {
	Subscription
	// GetChan resturns incoming records channel.
	GetChan() <-chan LogRecord
}

LogSubscription represents subscription to logger data.

type Member

type Member interface {
	// GetMembership returns user membership.
	GetMembership() Membership
}

Member describes an object that is a member of a group with access control.

type Membership

type Membership interface {
	// Get returns group info.
	Get() Group
	// IsAvailable returns true if one or more given groups are accessible for the membership.
	IsAvailable([]Rights) bool
}

Membership describes a membership object.

func CreateMembership

func CreateMembership(domain, name string) Membership

CreateMembership creates a new instance of Membership.

type Report

type Report interface {
	Member

	// GetID returns report ID.
	GetID() ReportID
	// GetTitle returns report title.
	GetTitle() string
	// GetDesc returns report description.
	GetDesc() string
	// GetAuthorLogin returns report login of report author.
	GetAuthorLogin() string
}

Report describes report record.

type ReportID

type ReportID uint64

ReportID is ID of a report.

type Reports

type Reports interface {
	// Close closes the collection.
	Close()

	// Add adds new report to the collection.
	Add(title string, desc string, user User) (Report, error)

	// GetAllAllowed returns list of all reports witch is allowed by given rights.
	GetAllAllowed([]Rights) ([]Report, error)

	// Subscribe creates a subscription to report collection modifications.
	Subscribe([]Rights) (ReportsSubscription, error)
}

Reports describes report collection access interface.

type ReportsSubscription

type ReportsSubscription interface {
	Subscription

	// GetChan resturns updates channel.
	GetChan() <-chan Report
}

ReportsSubscription represents subscription to report updates.

type Rights

type Rights interface {
	// Get returns group info.
	Get() Group
}

Rights describes an access rights group.

func CreateRights

func CreateRights(domain, name string) Rights

CreateRights creates a new instance of Rights.

type Rprt

type Rprt interface {
	// Close closes connection to rprt-service.
	Close()

	// GetNodeType returns node type name.
	GetNodeType() string
	// GetNodeName returns node name.
	GetNodeName() string

	// Log returns log service.
	Log() Log

	// GetFactory returns default objects factory.
	GetFactory() Factory

	// InitUsers inits users service.
	InitUsers() error
	// GetUsers returns users service.
	GetUsers() Users

	// InitReports inits reports service.
	InitReports() error
	// GetReports returns reports service.
	GetReports() Reports
}

Rprt defines a root service interface

func Dial

func Dial(nodeType, nodeName string, streamBrokers []string, factory Factory) (
	Rprt, error, error)

Dial creates a new connection to rprt-service.

func DialOrPanic

func DialOrPanic(
	nodeType, nodeName string, streamBrokers []string, factory Factory) Rprt

DialOrPanic creates a new connection to rprt-service or panics with error in standard output if creating is failed.

type Stream

type Stream interface {
	Close()
	GetRprt() Rprt
	GetClient() sarama.Client
}

Stream represents a data streaming client.

type Subscription

type Subscription interface {
	// Close closes the subscription.
	Close()
}

Subscription represents subscription object.

type User

type User interface {
	Member

	// GetLogin returns user login.
	GetLogin() string
	//GetRights returns groups with which user allows to work.
	GetRights() []Rights
}

User provides an interface of a user object.

type UserMethod

type UserMethod interface {
	Member

	// GetName returns method name.
	GetName() string
}

UserMethod describes a user method intarface.

func CreateUserMethod

func CreateUserMethod(name string, membership Membership) UserMethod

CreateUserMethod creates a UserMethod instance.

type UserMethods

type UserMethods interface {
	// Close closes database.
	Close()
	// Get returns a method by name.
	Get(method string) (UserMethod, error)
}

UserMethods provides a user methods database interface.

type Users

type Users interface {
	// Close closes database.
	Close()
	// Find tries to find a user by the login. Returns nil if the user isn't found.
	Find(login string) (User, error)
	// GetMethods returns user methods database.
	GetMethods() UserMethods
	// GetAll returns all users from the database.
	GetAll() []User
}

Users provides a user database interface.

Jump to

Keyboard shortcuts

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