curator

package
Version: v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: MIT Imports: 10 Imported by: 2

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.Type,
	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(
	userMetadata interface{}, 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 userMetadata is supplied.

func (*Impl) EditDocument added in v0.7.0

func (c *Impl) EditDocument(
	userMetadata interface{}, 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) ReadDocument added in v0.7.0

func (c *Impl) ReadDocument(
	userMetadata interface{}, 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,
	// providing metadata for identifying content produced by the client.
	EditDocument(
		userMetadata interface{}, token, documentID string, timeout time.Duration,
	) (binder.Portal, error)

	// ReadDocument - Find and return a binder portal to an existing document
	// with read only privileges, providing metadata for identifying content
	// produced by the client.
	ReadDocument(
		userMetadata interface{}, token, documentID string, timeout time.Duration,
	) (binder.Portal, error)

	// CreateDocument - Create and return a binder portal to a new document,
	// providing metadata for identifying content produced by the client.
	CreateDocument(
		userMetadata interface{}, token string, document store.Document, timeout time.Duration,
	) (binder.Portal, 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
t or T : Toggle theme light dark auto
y or Y : Canonical URL