continuity

package
v0.0.0-...-81cd3a7 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotResumable = *herodot.ErrBadRequest.WithError("session is not resumable").WithReasonf("No resumable session could be found in the HTTP Header.")

Functions

func TestPersister

func TestPersister(p interface {
	Persister
	identity.PrivilegedPool
}) func(t *testing.T)

Types

type Container

type Container struct {
	ID         uuid.UUID  `json:"id" db:"id"`
	Name       string     `json:"name" db:"name"`
	IdentityID *uuid.UUID `json:"identity_id" db:"identity_id"`

	// ExpiresAt defines when this container expires.
	ExpiresAt time.Time `json:"expires_at" db:"expires_at"`

	// Payload is the container's payload.
	Payload sqlxx.NullJSONRawMessage `json:"payload" db:"payload"`

	// CreatedAt is a helper struct field for gobuffalo.pop.
	CreatedAt time.Time `json:"-" db:"created_at"`

	// UpdatedAt is a helper struct field for gobuffalo.pop.
	UpdatedAt time.Time `json:"-" db:"updated_at"`
}

func NewContainer

func NewContainer(name string, o managerOptions) *Container

func (*Container) TableName

func (c *Container) TableName() string

func (*Container) UTC

func (c *Container) UTC() *Container

func (*Container) Valid

func (c *Container) Valid(identity uuid.UUID) error

type ManagementProvider

type ManagementProvider interface {
	ContinuityManager() Manager
}

type Manager

type Manager interface {
	Pause(ctx context.Context, w http.ResponseWriter, r *http.Request, name string, opts ...ManagerOption) error
	Continue(ctx context.Context, w http.ResponseWriter, r *http.Request, name string, opts ...ManagerOption) (*Container, error)
	Abort(ctx context.Context, w http.ResponseWriter, r *http.Request, name string) error
}

type ManagerCookie

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

func NewManagerCookie

func NewManagerCookie(d managerCookieDependencies) *ManagerCookie

func (ManagerCookie) Abort

func (*ManagerCookie) Continue

func (m *ManagerCookie) Continue(ctx context.Context, w http.ResponseWriter, r *http.Request, name string, opts ...ManagerOption) (*Container, error)

func (*ManagerCookie) Pause

func (m *ManagerCookie) Pause(ctx context.Context, w http.ResponseWriter, r *http.Request, name string, opts ...ManagerOption) error

type ManagerOption

type ManagerOption func(*managerOptions) error

func DontCleanUp

func DontCleanUp() ManagerOption

func WithIdentity

func WithIdentity(i *identity.Identity) ManagerOption

func WithLifespan

func WithLifespan(ttl time.Duration) ManagerOption

func WithPayload

func WithPayload(payload interface{}) ManagerOption

type PersistenceProvider

type PersistenceProvider interface {
	ContinuityPersister() Persister
}

type Persister

type Persister interface {
	SaveContinuitySession(ctx context.Context, c *Container) error
	GetContinuitySession(ctx context.Context, id uuid.UUID) (*Container, error)
	DeleteContinuitySession(ctx context.Context, id uuid.UUID) error
}

Jump to

Keyboard shortcuts

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