mock

package
v0.0.0-...-978c921 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: MIT, CC-BY-4.0, MIT, + 1 more Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAccount

func NewAccount(kms security.KMS, password string) (proto.Account, *security.ManagedKey, error)

func NewRoom

func NewRoom(
	ctx scope.Context, kms security.KMS, private bool, name, version string, managers ...proto.Account) (
	proto.ManagedRoom, error)

func TestSession

func TestSession(id, agentID, ip string) proto.Session

Types

type EmailTracker

type EmailTracker struct {
	// contains filtered or unexported fields
}

func (*EmailTracker) Get

func (et *EmailTracker) Get(ctx scope.Context, accountID snowflake.Snowflake, id string) (*emails.EmailRef, error)

func (*EmailTracker) List

func (et *EmailTracker) List(ctx scope.Context, accountID snowflake.Snowflake, n int, before time.Time) ([]*emails.EmailRef, error)

func (*EmailTracker) MarkDelivered

func (et *EmailTracker) MarkDelivered(ctx scope.Context, accountID snowflake.Snowflake, id string) error

func (*EmailTracker) Send

func (et *EmailTracker) Send(
	ctx scope.Context, js jobs.JobService, templater *templates.Templater, deliverer emails.Deliverer,
	account proto.Account, to, templateName string, data interface{}) (
	*emails.EmailRef, error)

type JobQueue

type JobQueue struct {
	// contains filtered or unexported fields
}

func (*JobQueue) Add

func (jq *JobQueue) Add(
	ctx scope.Context, jobType jobs.JobType, payload interface{}, options ...jobs.JobOption) (
	snowflake.Snowflake, error)

func (*JobQueue) AddAndClaim

func (jq *JobQueue) AddAndClaim(
	ctx scope.Context, jobType jobs.JobType, payload interface{}, handlerID string, options ...jobs.JobOption) (
	*jobs.Job, error)

func (*JobQueue) Cancel

func (jq *JobQueue) Cancel(ctx scope.Context, jobID snowflake.Snowflake) error

func (*JobQueue) Complete

func (jq *JobQueue) Complete(ctx scope.Context, jobID snowflake.Snowflake, handlerID string, attempt int32, log []byte) error

func (*JobQueue) Fail

func (jq *JobQueue) Fail(ctx scope.Context, jobID snowflake.Snowflake, handlerID string, attempt int32, reason string, log []byte) error

func (*JobQueue) Log

func (jq *JobQueue) Log(ctx scope.Context, jobID snowflake.Snowflake, attempt int32) (*jobs.JobLog, error)

func (*JobQueue) Name

func (jq *JobQueue) Name() string

func (*JobQueue) Stats

func (jq *JobQueue) Stats(ctx scope.Context) (jobs.JobQueueStats, error)

func (*JobQueue) TryClaim

func (jq *JobQueue) TryClaim(ctx scope.Context, handlerID string) (*jobs.Job, error)

func (*JobQueue) TrySteal

func (jq *JobQueue) TrySteal(ctx scope.Context, handlerID string) (*jobs.Job, error)

func (*JobQueue) WaitForJob

func (jq *JobQueue) WaitForJob(ctx scope.Context) error

type JobService

type JobService struct {
	// contains filtered or unexported fields
}

func (*JobService) GetQueue

func (js *JobService) GetQueue(ctx scope.Context, name string) (jobs.JobQueue, error)

type PM

type PM struct {
	RoomBase
	// contains filtered or unexported fields
}

func (*PM) ResolveNick

func (pm *PM) ResolveNick(ctx scope.Context, userID proto.UserID) (string, bool, error)

func (*PM) Snapshot

func (pm *PM) Snapshot(
	ctx scope.Context, session proto.Session, level proto.PrivilegeLevel, numMessages int) (*proto.SnapshotEvent, error)

type PMTracker

type PMTracker struct {
	// contains filtered or unexported fields
}

func (*PMTracker) Initiate

func (t *PMTracker) Initiate(
	ctx scope.Context, kms security.KMS, room proto.Room, client *proto.Client, recipient proto.UserID) (
	snowflake.Snowflake, error)

func (*PMTracker) Room

type RoomBase

type RoomBase struct {
	// contains filtered or unexported fields
}

func (*RoomBase) EditMessage

func (r *RoomBase) EditMessage(
	ctx scope.Context, session proto.Session, edit proto.EditMessageCommand) (
	proto.EditMessageReply, error)

func (*RoomBase) GetMessage

func (r *RoomBase) GetMessage(ctx scope.Context, id snowflake.Snowflake) (*proto.Message, error)

func (*RoomBase) ID

func (r *RoomBase) ID() string

func (*RoomBase) IsValidParent

func (r *RoomBase) IsValidParent(id snowflake.Snowflake) (bool, error)

func (*RoomBase) Join

func (r *RoomBase) Join(ctx scope.Context, session proto.Session) (string, error)

func (*RoomBase) Latest

func (r *RoomBase) Latest(ctx scope.Context, n int, before snowflake.Snowflake) ([]proto.Message, error)

func (*RoomBase) Listing

func (r *RoomBase) Listing(ctx scope.Context, level proto.PrivilegeLevel, exclude ...proto.Session) (proto.Listing, error)

func (*RoomBase) MessageKeyID

func (r *RoomBase) MessageKeyID(ctx scope.Context) (string, bool, error)

func (*RoomBase) Part

func (r *RoomBase) Part(ctx scope.Context, session proto.Session) error

func (*RoomBase) RenameUser

func (r *RoomBase) RenameUser(
	ctx scope.Context, session proto.Session, formerName string) (*proto.NickEvent, error)

func (*RoomBase) ResolveClientAddress

func (r *RoomBase) ResolveClientAddress(ctx scope.Context, addr string) (net.IP, error)

func (*RoomBase) ResolveNick

func (r *RoomBase) ResolveNick(ctx scope.Context, userID proto.UserID) (string, bool, error)

func (*RoomBase) Send

func (r *RoomBase) Send(ctx scope.Context, session proto.Session, message proto.Message) (
	proto.Message, error)

func (*RoomBase) Snapshot

func (r *RoomBase) Snapshot(
	ctx scope.Context, session proto.Session, level proto.PrivilegeLevel, numMessages int) (*proto.SnapshotEvent, error)

func (*RoomBase) Title

func (r *RoomBase) Title() string

func (*RoomBase) Version

func (r *RoomBase) Version() string

func (*RoomBase) WaitForPart

func (r *RoomBase) WaitForPart(sessionID string) error

type TestBackend

type TestBackend struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*TestBackend) AccountManager

func (b *TestBackend) AccountManager() proto.AccountManager

func (*TestBackend) AgentTracker

func (b *TestBackend) AgentTracker() proto.AgentTracker

func (*TestBackend) Ban

func (b *TestBackend) Ban(ctx scope.Context, ban proto.Ban, until time.Time) error

func (*TestBackend) Close

func (b *TestBackend) Close()

func (*TestBackend) CreateRoom

func (b *TestBackend) CreateRoom(
	ctx scope.Context, kms security.KMS, private bool, name string, managers ...proto.Account) (
	proto.ManagedRoom, error)

func (*TestBackend) EmailTracker

func (b *TestBackend) EmailTracker() proto.EmailTracker

func (*TestBackend) GetRoom

func (b *TestBackend) GetRoom(ctx scope.Context, name string) (proto.ManagedRoom, error)

func (*TestBackend) Jobs

func (b *TestBackend) Jobs() jobs.JobService

func (*TestBackend) NotifyUser

func (b *TestBackend) NotifyUser(ctx scope.Context, userID proto.UserID, packetType proto.PacketType, payload interface{}, excluding ...proto.Session) error

func (*TestBackend) PMTracker

func (b *TestBackend) PMTracker() proto.PMTracker

func (*TestBackend) Peers

func (b *TestBackend) Peers() []cluster.PeerDesc

func (*TestBackend) Unban

func (b *TestBackend) Unban(ctx scope.Context, ban proto.Ban) error

func (*TestBackend) Version

func (b *TestBackend) Version() string

Jump to

Keyboard shortcuts

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