Documentation ¶
Overview ¶
Package operations implements the operations that can be executed on the document.
Index ¶
- Variables
- type Add
- type Edit
- func (e *Edit) Attributes() map[string]string
- func (e *Edit) Content() string
- func (e *Edit) Execute(root *crdt.Root) error
- func (e *Edit) ExecutedAt() *time.Ticket
- func (e *Edit) From() *crdt.RGATreeSplitNodePos
- func (e *Edit) MaxCreatedAtMapByActor() map[string]*time.Ticket
- func (e *Edit) ParentCreatedAt() *time.Ticket
- func (e *Edit) SetActor(actorID *time.ActorID)
- func (e *Edit) To() *crdt.RGATreeSplitNodePos
- type Increase
- type Move
- type Operation
- type Remove
- type Set
- type Style
- func (e *Style) Attributes() map[string]string
- func (e *Style) Execute(root *crdt.Root) error
- func (e *Style) ExecutedAt() *time.Ticket
- func (e *Style) From() *crdt.RGATreeSplitNodePos
- func (e *Style) MaxCreatedAtMapByActor() map[string]*time.Ticket
- func (e *Style) ParentCreatedAt() *time.Ticket
- func (e *Style) SetActor(actorID *time.ActorID)
- func (e *Style) To() *crdt.RGATreeSplitNodePos
- type TreeEdit
- func (e *TreeEdit) Contents() []*crdt.TreeNode
- func (e *TreeEdit) Execute(root *crdt.Root) error
- func (e *TreeEdit) ExecutedAt() *time.Ticket
- func (e *TreeEdit) FromPos() *crdt.TreePos
- func (e *TreeEdit) MaxCreatedAtMapByActor() map[string]*time.Ticket
- func (e *TreeEdit) ParentCreatedAt() *time.Ticket
- func (e *TreeEdit) SetActor(actorID *time.ActorID)
- func (e *TreeEdit) SplitLevel() int
- func (e *TreeEdit) ToPos() *crdt.TreePos
- type TreeStyle
- func (e *TreeStyle) Attributes() map[string]string
- func (e *TreeStyle) AttributesToRemove() []string
- func (e *TreeStyle) Execute(root *crdt.Root) error
- func (e *TreeStyle) ExecutedAt() *time.Ticket
- func (e *TreeStyle) FromPos() *crdt.TreePos
- func (e *TreeStyle) MaxCreatedAtMapByActor() map[string]*time.Ticket
- func (e *TreeStyle) ParentCreatedAt() *time.Ticket
- func (e *TreeStyle) SetActor(actorID *time.ActorID)
- func (e *TreeStyle) ToPos() *crdt.TreePos
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotApplicableDataType occurs when attempting to execute an operation // on a data type that cannot be executed. ErrNotApplicableDataType = errors.New("not applicable datatype") )
Functions ¶
This section is empty.
Types ¶
type Add ¶
type Add struct {
// contains filtered or unexported fields
}
Add is an operation representing adding an element to an Array.
func NewAdd ¶
func NewAdd( parentCreatedAt *time.Ticket, prevCreatedAt *time.Ticket, value crdt.Element, executedAt *time.Ticket, ) *Add
NewAdd creates a new instance of Add.
func (*Add) ExecutedAt ¶
ExecutedAt returns execution time of this operation.
func (*Add) ParentCreatedAt ¶
ParentCreatedAt returns the creation time of the Array.
func (*Add) PrevCreatedAt ¶
PrevCreatedAt returns the creation time of previous element.
type Edit ¶
type Edit struct {
// contains filtered or unexported fields
}
Edit is an operation representing editing Text. Most of the same as Edit, but with additional style properties, attributes.
func NewEdit ¶
func NewEdit( parentCreatedAt *time.Ticket, from *crdt.RGATreeSplitNodePos, to *crdt.RGATreeSplitNodePos, maxCreatedAtMapByActor map[string]*time.Ticket, content string, attributes map[string]string, executedAt *time.Ticket, ) *Edit
NewEdit creates a new instance of Edit.
func (*Edit) Attributes ¶ added in v0.3.0
Attributes returns the attributes of this Edit.
func (*Edit) ExecutedAt ¶
ExecutedAt returns execution time of this operation.
func (*Edit) From ¶
func (e *Edit) From() *crdt.RGATreeSplitNodePos
From returns the start point of the editing range.
func (*Edit) MaxCreatedAtMapByActor ¶ added in v0.4.19
MaxCreatedAtMapByActor returns the map that stores the latest creation time by actor for the nodes included in the editing range.
func (*Edit) ParentCreatedAt ¶
ParentCreatedAt returns the creation time of the Text.
func (*Edit) To ¶
func (e *Edit) To() *crdt.RGATreeSplitNodePos
To returns the end point of the editing range.
type Increase ¶
type Increase struct {
// contains filtered or unexported fields
}
Increase represents an operation that increments a numeric value to Counter. Among Primitives, numeric types Integer, Long, and Double are used as values.
func NewIncrease ¶
func NewIncrease( parentCreatedAt *time.Ticket, value crdt.Element, executedAt *time.Ticket, ) *Increase
NewIncrease creates the increase instance.
func (*Increase) ExecutedAt ¶
ExecutedAt returns execution time of this operation.
func (*Increase) ParentCreatedAt ¶
ParentCreatedAt returns the creation time of Counter.
type Move ¶
type Move struct {
// contains filtered or unexported fields
}
Move is an operation representing moving an element to an Array.
func NewMove ¶
func NewMove( parentCreatedAt *time.Ticket, prevCreatedAt *time.Ticket, createdAt *time.Ticket, executedAt *time.Ticket, ) *Move
NewMove creates a new instance of Move.
func (*Move) ExecutedAt ¶
ExecutedAt returns execution time of this operation.
func (*Move) ParentCreatedAt ¶
ParentCreatedAt returns the creation time of the Array.
func (*Move) PrevCreatedAt ¶
PrevCreatedAt returns the creation time of previous element.
type Operation ¶
type Operation interface { // Execute executes this operation on the given document(`root`). Execute(root *crdt.Root) error // ExecutedAt returns execution time of this operation. ExecutedAt() *time.Ticket // SetActor sets the given actor to this operation. SetActor(id *time.ActorID) // ParentCreatedAt returns the creation time of the target element to // execute the operation. ParentCreatedAt() *time.Ticket }
Operation represents an operation to be executed on a document.
type Remove ¶
type Remove struct {
// contains filtered or unexported fields
}
Remove is an operation representing removes an element from Container.
func NewRemove ¶
func NewRemove( parentCreatedAt *time.Ticket, createdAt *time.Ticket, executedAt *time.Ticket, ) *Remove
NewRemove creates a new instance of Remove.
func (*Remove) ExecutedAt ¶
ExecutedAt returns execution time of this operation.
func (*Remove) ParentCreatedAt ¶
ParentCreatedAt returns the creation time of the Container.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set represents an operation that stores the value corresponding to the given key in the Object.
func NewSet ¶
func NewSet( parentCreatedAt *time.Ticket, key string, value crdt.Element, executedAt *time.Ticket, ) *Set
NewSet creates a new instance of Set.
func (*Set) ExecutedAt ¶
ExecutedAt returns execution time of this operation.
func (*Set) ParentCreatedAt ¶
ParentCreatedAt returns the creation time of the Object.
type Style ¶
type Style struct {
// contains filtered or unexported fields
}
Style is an operation applies the style of the given range to Text.
func NewStyle ¶
func NewStyle( parentCreatedAt *time.Ticket, from *crdt.RGATreeSplitNodePos, to *crdt.RGATreeSplitNodePos, maxCreatedAtMapByActor map[string]*time.Ticket, attributes map[string]string, executedAt *time.Ticket, ) *Style
NewStyle creates a new instance of Style.
func (*Style) Attributes ¶
Attributes returns the attributes of this operation.
func (*Style) ExecutedAt ¶
ExecutedAt returns execution time of this operation.
func (*Style) From ¶
func (e *Style) From() *crdt.RGATreeSplitNodePos
From returns the start point of the editing range.
func (*Style) MaxCreatedAtMapByActor ¶ added in v0.4.19
MaxCreatedAtMapByActor returns the map that stores the latest creation time by actor for the nodes included in the range to apply the style to.
func (*Style) ParentCreatedAt ¶
ParentCreatedAt returns the creation time of the Text.
func (*Style) To ¶
func (e *Style) To() *crdt.RGATreeSplitNodePos
To returns the end point of the editing range.
type TreeEdit ¶ added in v0.4.0
type TreeEdit struct {
// contains filtered or unexported fields
}
TreeEdit is an operation representing Tree editing.
func NewTreeEdit ¶ added in v0.4.0
func NewTreeEdit( parentCreatedAt *time.Ticket, from *crdt.TreePos, to *crdt.TreePos, contents []*crdt.TreeNode, splitLevel int, maxCreatedAtMapByActor map[string]*time.Ticket, executedAt *time.Ticket, ) *TreeEdit
NewTreeEdit creates a new instance of TreeEdit.
func (*TreeEdit) ExecutedAt ¶ added in v0.4.0
ExecutedAt returns execution time of this operation.
func (*TreeEdit) MaxCreatedAtMapByActor ¶ added in v0.4.19
MaxCreatedAtMapByActor returns the map that stores the latest creation time by actor for the nodes included in the editing range.
func (*TreeEdit) ParentCreatedAt ¶ added in v0.4.0
ParentCreatedAt returns the creation time of the Text.
func (*TreeEdit) SplitLevel ¶ added in v0.4.10
SplitLevel returns the level of the split.
type TreeStyle ¶ added in v0.4.2
type TreeStyle struct {
// contains filtered or unexported fields
}
TreeStyle represents the style operation of the tree.
func NewTreeStyle ¶ added in v0.4.2
func NewTreeStyle( parentCreatedAt *time.Ticket, from *crdt.TreePos, to *crdt.TreePos, maxCreatedAtMapByActor map[string]*time.Ticket, attributes map[string]string, executedAt *time.Ticket, ) *TreeStyle
NewTreeStyle creates a new instance of TreeStyle.
func NewTreeStyleRemove ¶ added in v0.4.13
func NewTreeStyleRemove( parentCreatedAt *time.Ticket, from *crdt.TreePos, to *crdt.TreePos, maxCreatedAtMapByActor map[string]*time.Ticket, attributesToRemove []string, executedAt *time.Ticket, ) *TreeStyle
NewTreeStyleRemove creates a new instance of TreeStyle.
func (*TreeStyle) Attributes ¶ added in v0.4.2
Attributes returns the content of Style.
func (*TreeStyle) AttributesToRemove ¶ added in v0.4.13
AttributesToRemove returns the content of Style.
func (*TreeStyle) Execute ¶ added in v0.4.2
Execute executes this operation on the given `CRDTRoot`.
func (*TreeStyle) ExecutedAt ¶ added in v0.4.2
ExecutedAt returns execution time of this operation.
func (*TreeStyle) MaxCreatedAtMapByActor ¶ added in v0.4.19
MaxCreatedAtMapByActor returns the map that stores the latest creation time by actor for the nodes included in the styling range.
func (*TreeStyle) ParentCreatedAt ¶ added in v0.4.2
ParentCreatedAt returns the creation time of the Text.