leaps: github.com/Jeffail/leaps/lib/curator Index | Files

package curator

import "github.com/Jeffail/leaps/lib/curator"

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

Package Files

curator.go interface.go package.go

Variables

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

Errors for the Curator type.

type AuditorContainer Uses

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 Uses

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

Config - Holds configuration options for a curator.

func NewConfig Uses

func NewConfig() Config

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

type Impl Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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.

Package curator imports 10 packages (graph) and is imported by 1 packages. Updated 2018-02-20. Refresh now. Tools for package owners.