localsession

package
v0.0.0-...-335d32b Latest Latest
Warning

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

Go to latest
Published: May 29, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

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

Session is the implementation of rinq.Session.

The implementation is split into two files. This file contains methods that are declared in rinq.Session, whereas the session_state.go file contains a lower-level API for manipulating the session state which is used throughout the Rinq internals.

func NewSession

func NewSession(
	id ident.SessionID,
	invoker command.Invoker,
	notifier notify.Notifier,
	listener notify.Listener,
	logger twelf.Logger,
	tracer opentracing.Tracer,
) *Session

NewSession returns a new local session.

func (*Session) At

func (s *Session) At(rev ident.Revision) (rinq.Revision, error)

At returns a revision representing the state at a specific revision number. The revision can not be newer than the current session-ref.

func (*Session) Attrs

func (s *Session) Attrs() (ident.Ref, attributes.Catalog)

Attrs returns all attributes at the most recent revision.

func (*Session) AttrsIn

func (s *Session) AttrsIn(ns string) (ident.Ref, attributes.VTable)

AttrsIn returns all attributes in the ns namespace at the most recent revision.

func (*Session) Call

func (s *Session) Call(ctx context.Context, ns, cmd string, out *rinq.Payload) (*rinq.Payload, error)

Call implements rinq.Session.Call()

func (*Session) CallAsync

func (s *Session) CallAsync(ctx context.Context, ns, cmd string, out *rinq.Payload) (ident.MessageID, error)

CallAsync implements rinq.Session.CallAsync()

func (*Session) CurrentRevision

func (s *Session) CurrentRevision() rinq.Revision

CurrentRevision implements rinq.Session.CurrentRevision()

func (*Session) Destroy

func (s *Session) Destroy()

Destroy implements rinq.Session.Destroy()

func (*Session) Done

func (s *Session) Done() <-chan struct{}

Done implements rinq.Session.Done()

func (*Session) Execute

func (s *Session) Execute(ctx context.Context, ns, cmd string, p *rinq.Payload) error

Execute implements rinq.Session.Execute()

func (*Session) ID

func (s *Session) ID() ident.SessionID

ID implements rinq.Session.ID()

func (*Session) Listen

func (s *Session) Listen(ns string, h rinq.NotificationHandler) error

Listen implements rinq.Session.Listen()

func (*Session) Notify

func (s *Session) Notify(ctx context.Context, ns, t string, target ident.SessionID, p *rinq.Payload) error

Notify implements rinq.Session.Notify()

func (*Session) NotifyMany

func (s *Session) NotifyMany(ctx context.Context, ns, t string, con constraint.Constraint, p *rinq.Payload) error

NotifyMany implements rinq.Session.NotifyMany()

func (*Session) SetAsyncHandler

func (s *Session) SetAsyncHandler(h rinq.AsyncHandler) error

SetAsyncHandler implements rinq.Session.SetAsyncHandler()

func (*Session) TryClear

func (s *Session) TryClear(rev ident.Revision, ns string) (rinq.Revision, *attributes.Diff, error)

TryClear updates all attributes in the ns namespace of the attribute table to the empty string and returns the new head revision.

The operation fails if ref is not the current session-ref, there are any frozen attributes, or the session has been destroyed.

func (*Session) TryDestroy

func (s *Session) TryDestroy(rev ident.Revision) (bool, error)

TryDestroy destroys the session, preventing further updates.

The operation fails if ref is not the current session-ref. It is not an error to destroy an already-destroyed session.

first is true if this call caused the session to be destroyed.

func (*Session) TryUpdate

func (s *Session) TryUpdate(rev ident.Revision, ns string, attrs attributes.List) (rinq.Revision, *attributes.Diff, error)

TryUpdate adds or updates attributes in the ns namespace of the attribute table and returns the new head revision.

The operation fails if ref is not the current session-ref, attrs includes changes to frozen attributes, or the session has been destroyed.

func (*Session) Unlisten

func (s *Session) Unlisten(ns string) error

Unlisten implements rinq.Session.Unlisten()

type Store

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

Store is a collection of local sessions which provides an implementation of revisions.Store.

func NewStore

func NewStore() *Store

NewStore returns a new session store.

func (*Store) Add

func (s *Store) Add(sess *Session)

Add adds a session to the store.

func (*Store) Each

func (s *Store) Each(fn func(*Session))

Each calls fn(sess) for each session in the store.

func (*Store) Get

func (s *Store) Get(id ident.SessionID) (sess *Session, ok bool)

Get fetches a session from the store by its ID.

func (*Store) GetRevision

func (s *Store) GetRevision(ref ident.Ref) (rinq.Revision, error)

GetRevision returns the session revision for the given ref.

func (*Store) Remove

func (s *Store) Remove(id ident.SessionID)

Remove removes a session to from the store.

Jump to

Keyboard shortcuts

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