audit

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: 5 Imported by: 2

Documentation

Overview

Package audit - Implementations of operational transform auditors responsible for taking a stream of operational transform and creating useful features from that stream.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auditor

type Auditor interface {
	// OnTransform - Is called by binder threads synchronously for each received
	// transform. Therefore, the implementation must be thread safe and avoid
	// blocking. An implementation may wish to perform validation on the
	// transform, in the case of a 'fail' an error should be returned, which
	// will prevent the transform from being applied.
	OnTransform(tform text.OTransform) error
}

Auditor - A type that receives all transforms from a running binder as they arrive. The purpose of this type is to expose the flowing data to other components.

type CompressedAuditor

type CompressedAuditor struct {
	Transforms []text.OTransform
	// contains filtered or unexported fields
}

CompressedAuditor - Audit a documents transforms into a compressed structure for serialisation.

func (*CompressedAuditor) OnTransform

func (d *CompressedAuditor) OnTransform(tform text.OTransform) error

OnTransform - Is called for every transform on a document as they arrive.

type ToJSON

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

ToJSON - An auditor collection that takes streams of operational transforms and can serialise them to JSON format: {

"document_1": [...],
"document_2": [...]

}

func NewToJSON

func NewToJSON() *ToJSON

NewToJSON - Create a new auditor collection that serialises to JSON structure.

func (*ToJSON) Deserialise

func (t *ToJSON) Deserialise(data []byte) error

Deserialise - Repopulate all audits based on a JSON serialised copy.

func (*ToJSON) Get

func (t *ToJSON) Get(binderID string) (Auditor, error)

Get - Return an auditor for a document.

func (*ToJSON) Reapply

func (t *ToJSON) Reapply(docStore store.Type) error

Reapply - Reapply the audited changes to a document store.

func (*ToJSON) Serialise

func (t *ToJSON) Serialise() ([]byte, error)

Serialise - Return a JSON serialised copy of all audits.

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