accesspoint

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateClientID

func CreateClientID(conn *kite.Client) string

CreateClientID creates a client ID for client instance.

func FormatClientLog

func FormatClientLog(connID, login, format string, args ...interface{}) string

FormatClientLog format client log record.

func RegisterMethods

func RegisterMethods(
	clients Clients,
	registerHandler func(
		name string,
		handleFunc func(request *kite.Request) (interface{}, error)),
	service rprt.Rprt)

RegisterMethods registers all available access point methods.

Types

type Client

type Client interface {
	Close()

	GetConnID() string
	GetConn() Conn
	GetUser() rprt.User

	IsAllowed(member rprt.Member) bool

	LogError(format string, args ...interface{})
	LogWarn(format string, args ...interface{})
	LogInfo(format string, args ...interface{})
	LogDebug(format string, args ...interface{})

	Auth(Request) (interface{}, error)
	GetMethods(Request) (interface{}, error)
	GetUsers(Request) (interface{}, error)

	SubscribeToLog(Request) (interface{}, error)
	UnsubscribeFromLog(Request) (interface{}, error)

	AddReport(Request) (interface{}, error)
	GetReportList(Request) (interface{}, error)
	SubscribeToReports(Request) (interface{}, error)
	UnsubscribeFromReports(Request) (interface{}, error)

	Test(Request) (interface{}, error)
}

Client is an access point connected client.

func CreateClient

func CreateClient(
	connID string, user rprt.User, conn Conn,
	clients Clients, rprt rprt.Rprt) Client

CreateClient creates a new Client instance.

type Clients

type Clients interface {
	// Close closes the database.
	Close()

	// Get returns client by kite.Client.
	Get(*kite.Client) (Client, error)

	// Add adds new connetion in the database.
	Add(Client)
	// Remove removes a connetion from the database.
	Remove(*kite.Client)

	// RegisterMethod informs the client object about new method for users.
	RegisterMethod(rprt.UserMethod)
	// GetMethod returns a method list witch available.
	GetMethods() []rprt.UserMethod
}

Clients is a connected clients database.

func CreateClients

func CreateClients(service rprt.Rprt) Clients

CreateClients creates a new Clients instance.

type Conn

type Conn interface {
	Close()
	GetHandle() *kite.Client
	CallRemoteWithTimeout(
		method string, timeout time.Duration, args ...interface{}) (
		*dnode.Partial, error)
}

Conn wraps Kite client object.

func CreateConn

func CreateConn(kite *kite.Client) Conn

CreateConn creates new Conn interface.

type GroupMessage

type GroupMessage struct {
	Domain string
	Name   string
}

GroupMessage describes message format for group record.

func CreateGroupMessage

func CreateGroupMessage(group rprt.Group) GroupMessage

CreateGroupMessage creates GroupMessage object from rprt.Group.

type LogRecordMessage

type LogRecordMessage struct {
	SequenceNumber int64  `json:"seqNum"`
	Time           int64  `json:"time"`
	Text           string `json:"text"`
	Severity       string `json:"severity"`
	NodeType       string `json:"nodeType"`
	NodeName       string `json:"nodeName"`
}

LogRecordMessage describes message format for log record.

func CreateLogRecordMessage

func CreateLogRecordMessage(record rprt.LogRecord) LogRecordMessage

CreateLogRecordMessage creates LogRecordMessage object from rprt.LogRecord.

type ReportMessage

type ReportMessage struct {
	ID         rprt.ReportID `json:"id"`
	Title      string        `json:"title"`
	Desc       string        `json:"desc"`
	Author     string        `json:"author"`
	Membership GroupMessage  `json:"membership"`
}

ReportMessage describes message format for report record.

func CreateReportMessage

func CreateReportMessage(report rprt.Report) ReportMessage

CreateReportMessage creates ReportMessage object from rprt.Report.

type Request

type Request interface {
	GetArgs() RequestArgs
}

Request wraps kite.Request.

func CreateRequest

func CreateRequest(kiteRequest *kite.Request) Request

CreateRequest creates an instance of Request

type RequestArgs

type RequestArgs interface {
	GetString() string
	Unmarshal(interface{}) error
}

RequestArgs wraps dnode.Partial

Jump to

Keyboard shortcuts

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