curator

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2017 License: MIT Imports: 11 Imported by: 6

Documentation

Overview

Package curator - Defines the type used to interact with leaps documents. The curator manages all documents, edit sessions, and any clean up duties. Uses dependency injected store and acl types for accessing documents and enforcing authentication/access control.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBinderNotFound = errors.New("binder was not found")
)

Errors for the Curator type.

Functions

This section is empty.

Types

type AuditorContainer added in v0.7.0

type AuditorContainer interface {
	// Get - Return a managed Auditor type for a binder ID.
	Get(binderID string) (audit.Auditor, error)
}

AuditorContainer - A type responsible for creating and managing auditors for string identified operational transform binders.

type Config

type Config struct {
	BinderConfig binder.Config `json:"binder" yaml:"binder"`
}

Config - Holds configuration options for a curator.

func NewConfig

func NewConfig() Config

NewConfig - Returns a fully defined curator configuration with the default values for each field.

type Impl added in v0.7.0

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

Impl - The underlying implementation of the curator type. Creates and manages the entire lifecycle of binders internally.

func New

func New(
	config Config,
	log log.Modular,
	stats metrics.Aggregator,
	auth acl.Authenticator,
	store store.Type,
	auditors AuditorContainer,
) (*Impl, error)

New - Creates and returns a new curator, and launches its internal loop.

func (*Impl) Close added in v0.7.0

func (c *Impl) Close()

Close - Shut the curator and all subsequent binders down. This call blocks until the shut down is finished, and you must ensure that this curator cannot be accessed after closing.

func (*Impl) CreateDocument added in v0.7.0

func (c *Impl) CreateDocument(
	userID, token string, doc store.Document, timeout time.Duration,
) (binder.Portal, error)

CreateDocument - Creates a fresh Binder for a new document, which is subsequently stored, returns an error if either the document ID is already currently in use, or if there is a problem storing the new document. May require authentication, if so a userID is supplied.

func (*Impl) EditDocument added in v0.7.0

func (c *Impl) EditDocument(
	userID, token, documentID string, timeout time.Duration,
) (binder.Portal, error)

EditDocument - Locates or creates a Binder for an existing document and returns that Binder for subscribing to. Returns an error if there was a problem locating the document.

func (*Impl) GetUsers added in v0.7.0

func (c *Impl) GetUsers(timeout time.Duration) (map[string][]string, error)

GetUsers - Return a full list of all connected users of all open documents.

func (*Impl) KickUser added in v0.7.0

func (c *Impl) KickUser(documentID, userID string, timeout time.Duration) error

KickUser - Remove a user from a document, requires the respective user and document IDs.

func (*Impl) ReadDocument added in v0.7.0

func (c *Impl) ReadDocument(
	userID, token, documentID string, timeout time.Duration,
) (binder.Portal, error)

ReadDocument - Locates or creates a Binder for an existing document and returns that Binder for subscribing to with read only privileges. Returns an error if there was a problem locating the document.

type Type

type Type interface {
	// EditDocument - Find and return a binder portal to an existing document
	EditDocument(userID, token, documentID string, timeout time.Duration) (binder.Portal, error)

	// ReadDocument - Find and return a binder portal to an existing document with read only
	// privileges
	ReadDocument(userID, token, documentID string, timeout time.Duration) (binder.Portal, error)

	// CreateDocument - Create and return a binder portal to a new document
	CreateDocument(
		userID, token string, document store.Document, timeout time.Duration,
	) (binder.Portal, error)

	// Kick a user from a document, needs the documentID and userID.
	KickUser(documentID, userID string, timeout time.Duration) error

	// Get the list of all users connected to all open binders.
	GetUsers(timeout time.Duration) (map[string][]string, error)

	// Close - Close the Curator
	Close()
}

Type - Provides thread safe implementations of basic document and session creation.

Jump to

Keyboard shortcuts

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