changes

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2018 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package changes implements backward-compatible Change api as defined in older version of Pydio

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDAO

func NewDAO(o dao.DAO) dao.DAO

Types

type ChangeBuffer

type ChangeBuffer struct {
	*list.List
}

ChangeBuffer contains a full set of changes affecting a single node.

func (*ChangeBuffer) Append

func (b *ChangeBuffer) Append(c *tree.SyncChange)

Append the change to the end of the buffer

func (*ChangeBuffer) Range

func (b *ChangeBuffer) Range() <-chan *list.Element

Range over the list

type ChangeChan

type ChangeChan <-chan *tree.SyncChange

ChangeChan is a naive implementation of ChangeStreamer that performs no pre-processing.

func (ChangeChan) Changes

func (ch ChangeChan) Changes() <-chan *tree.SyncChange

Changes produces a read-only stream of *tree.Change instances. It performs no pre-processing.

type ChangeOperation

type ChangeOperation interface {
	GetSeq() uint64
	GetNodeId() string
	OpType() OpCode
	GetSource() string
	GetTarget() string
}

ChangeOperation can inform us of the nature of a change

type ChangeStreamer

type ChangeStreamer interface {
	Changes() <-chan *tree.SyncChange
}

ChangeStreamer is used to avoid sending bidirectional channels to the optimizer. It types the channel as <-chan and also provides a place to hook in close logic & pre-processing.

type DAO

type DAO interface {
	dao.DAO

	Put(*tree.SyncChange) error
	Get(uint64, string) (chan *tree.SyncChange, error)
	LastSeq() (uint64, error)
	HasNodeById(id string) (bool, error)
}

DAO extends sql.DAO for the changes service

type OpCode

type OpCode uint8

OpCode is an opaque identifier for the operation type

func (OpCode) Create

func (op OpCode) Create() bool

Create operation

func (OpCode) Delete

func (op OpCode) Delete() bool

Delete operation

func (OpCode) Move

func (op OpCode) Move() bool

Move operation

func (OpCode) Null

func (op OpCode) Null() bool

Null operation

func (OpCode) Update

func (op OpCode) Update() bool

Update operation

type StreamConsumer

type StreamConsumer interface {
	Send(*tree.SyncChange) error
}

StreamConsumer can receive a *tree.SyncChange.

type StreamOptimizer

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

StreamOptimizer applies optimizations to the stream of changes.

func NewOptimizer

func NewOptimizer(ctx context.Context, c ChangeStreamer) (o *StreamOptimizer)

NewOptimizer produces a new StreamOptimizer.

func (StreamOptimizer) Output

func (o StreamOptimizer) Output(ctx context.Context, c StreamConsumer) (err error)

Output the optimized stream to a consumer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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