agent

package
v0.0.0-...-c59394f Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2017 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Validators []Validator
}

Auth authes

func (Auth) Authenticate

func (a Auth) Authenticate(accessKey string, secretKey string) (err error)

Authenticate authenticates the accessKey and secretKey. Try to find the corresponding userID of the accessKey.

type MasterAgent

type MasterAgent struct {
	Address string
	http.Handler
	MasterService
}

MasterAgent for a agent of master node

func NewMasterAgent

func NewMasterAgent(service MasterService, address string) *MasterAgent

NewMasterAgent allocates a new MasterAgent to handle the HTTP API

type MasterService

type MasterService interface {
	AssignNode(userID int64, queueName string, squadName string) (string, error)
	AddNode(info models.NodeInfo)
}

MasterService can distributes a node for a consume

type QueueAgent

type QueueAgent struct {
	Address string
	http.Handler
	QueueService
}

QueueAgent for a queue HTTP agent

func NewQueueAgent

func NewQueueAgent(service QueueService, address string) *QueueAgent

NewQueueAgent allocates and returns a new QueueAgent

type QueueService

type QueueService interface {
	ApplyMessageIDRange(userID int64, queueName string, size int) (maxID int64, err error)
	PushMessage(userID int64, queueName, content string, index int64) error
	PullMessages(userID int64, queueName, squadName string, length int) ([]models.Message, error)
	ReportMaxReceivedMessageID(userID int64, queueName, squadName string, messageID int64) error
	Info() models.NodeInfo
}

QueueService defines what a queue admin should do

type Validator

type Validator interface {
	Validate(accessKey string, secretKey string) (err error)
}

Validator authenticates the given accessKey and secretKey.

type ValidatorFunc

type ValidatorFunc func(accessKey string, secretKey string) (err error)

ValidatorFunc func to interface helper

func (ValidatorFunc) Validate

func (v ValidatorFunc) Validate(accessKey string, secretKey string) (err error)

Validate implements the Validator interface

Jump to

Keyboard shortcuts

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