session

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: Apache-2.0 Imports: 19 Imported by: 1,192

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllSessionIDs added in v0.8.0

func AllSessionIDs(g Group) (out []string)

func MethodURL

func MethodURL(s, m string) string

MethodURL returns a gRPC method URL for service and method name

Types

type Attachable

type Attachable interface {
	Register(*grpc.Server)
}

Attachable defines a feature that can be exposed on a session

type Caller

type Caller interface {
	Context() context.Context
	Supports(method string) bool
	Conn() *grpc.ClientConn
	Name() string
	SharedKey() string
}

Caller can invoke requests on the session

type Dialer

type Dialer func(ctx context.Context, proto string, meta map[string][]string) (net.Conn, error)

Dialer returns a connection that can be used by the session

type Group added in v0.8.0

type Group interface {
	SessionIterator() Iterator
}

func NewGroup added in v0.8.0

func NewGroup(ids ...string) Group

type Iterator added in v0.8.0

type Iterator interface {
	NextSession() string
}

type Manager

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

Manager is a controller for accessing currently active sessions

func NewManager

func NewManager() (*Manager, error)

NewManager returns a new Manager

func (*Manager) Any added in v0.8.0

func (sm *Manager) Any(ctx context.Context, g Group, f func(context.Context, string, Caller) error) error

func (*Manager) Get

func (sm *Manager) Get(ctx context.Context, id string, noWait bool) (Caller, error)

Get returns a session by ID

func (*Manager) HandleConn

func (sm *Manager) HandleConn(ctx context.Context, conn net.Conn, opts map[string][]string) error

HandleConn handles an incoming raw connection

func (*Manager) HandleHTTPRequest

func (sm *Manager) HandleHTTPRequest(ctx context.Context, w http.ResponseWriter, r *http.Request) error

HandleHTTPRequest handles an incoming HTTP request

type Session

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

Session is a long running connection between client and a daemon

func NewSession

func NewSession(ctx context.Context, name, sharedKey string) (*Session, error)

NewSession returns a new long running session

func (*Session) Allow

func (s *Session) Allow(a Attachable)

Allow enables a given service to be reachable through the grpc session

func (*Session) Close

func (s *Session) Close() error

Close closes the session

func (*Session) ID

func (s *Session) ID() string

ID returns unique identifier for the session

func (*Session) Run

func (s *Session) Run(ctx context.Context, dialer Dialer) error

Run activates the session

Jump to

Keyboard shortcuts

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