facade

package
v1.0.0-...-3fe6b38 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MultiFS

type MultiFS struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

MultiFS allows to attach multiple file systems to application bundle. File systems are being searched for file in the order they are attached. MultiFS embeds sync.RWLock for protection from possible data races.

func (*MultiFS) Attach

func (mfs *MultiFS) Attach(fs http.FileSystem)

Attach file system fs.

func (*MultiFS) Open

func (mfs *MultiFS) Open(name string) (http.File, error)

Implement http.MultiFS interface. Open searches for the file with name on all file systems attached in order of they were added.

type MultiSession

type MultiSession struct {
	// Session identifier implementation.
	Who session.Identifier

	// Session store implementation.
	Store session.Store

	// Session event bus.
	EventBus event.Bus
}

MultiSessions supports multiple sessions with persistence mechanism provided by session Store. By default newly created session' context is initialized with context.Background() unless session context fields is set.

func (*MultiSession) Resolve

func (ms *MultiSession) Resolve(r *http.Request) (sess *session.Session, err error)

Implement session.Resolver interface.

type Reactor

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

Reactor implements event.Bus interface and establishes event processing.

func NewReactor

func NewReactor() *Reactor

func (*Reactor) Consume

func (r *Reactor) Consume(buf []event.Event, ctx context.Context) error

Implement event.Consumer interface. The enter point of inbound events.

func (*Reactor) Produce

func (r *Reactor) Produce(buf []event.Event, ctx context.Context) (n int, err error)

Implement event.Producer interface. The leave point of outbound events.

type SessionPool

type SessionPool struct {
	New session.Starter
	// contains filtered or unexported fields
}

SessionPool implements session.Store interface and provides in-memoty session store based on sync.Map.

func (*SessionPool) Exists

func (sp *SessionPool) Exists(sessId string) bool

Implement session.Store interface. Test the session with the sessId exists in map.

func (*SessionPool) Persist

func (sp *SessionPool) Persist(sess *session.Session) error

Implement session.Persister interface. Store the session sess in map.

func (*SessionPool) Restore

func (sp *SessionPool) Restore(sessId string) (sess *session.Session, err error)

Implement session.Restorer interface. Restore the session from map.

func (*SessionPool) Start

func (sp *SessionPool) Start(sessId string) (sess *session.Session, err error)

Implement session.Starter interface. Start a new session with starter New.

type SingleSession

type SingleSession struct {
	sync.RWMutex

	// The default context to supply the created session with. Will be initialized with context.Background()
	// if not set.
	Context context.Context

	// The default session identifier. The new random identifier will be generated when session is created
	// if the identifier is empty.
	Id string

	// The user instance the session contains.
	User *session.User

	// The state instance the session contains.
	State interface{}

	// Session event bus.
	EventBus event.Bus
	// contains filtered or unexported fields
}

SingleSessions supports only one session (single user approach). The session uses sync.RWMutex as data races protection and it is recommended to use the mutex embedded when accessing fields of the session.

func (*SingleSession) Resolve

func (ss *SingleSession) Resolve(r *http.Request) (*session.Session, error)

Implement session.Resolver interface. The session is created the first time the resolution happens and then reused each time the resolution is issued.

Jump to

Keyboard shortcuts

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