Class: HistoryBuffer
Defined in: | lib/HistoryBuffer.coffee |
Overview
An object that holds all applied operations.
Instance Method Summary
- # (void) getUserId() Get the user id with wich the History Buffer was initialized.
- # (void) getReservedUniqueIdentifier() There is only one reserved unique identifier (uid), so use it wisely.
- # (void) getOperationCounter() Get the operation counter that describes the current state of the document.
- # (void) _encode(state_vector = {}) Encode this operation in such a way that it can be parsed by remote peers.
- # (void) getNextOperationIdentifier(user_id) Get the number of operations that were created by a user.
- # (void) getOperation(uid) Retrieve an operation from a unique id.
- # (void) addOperation(o) Add an operation to the HB.
- # (void) addToCounter(o) Increment the operation_counter that defines the current state of the Engine.
Constructor Details
#
(void)
constructor(user_id)
Creates an empty HB.
Instance Method Details
#
(void)
getUserId()
Get the user id with wich the History Buffer was initialized.
#
(void)
getReservedUniqueIdentifier()
There is only one reserved unique identifier (uid), so use it wisely. I propose to use it in your Framework, to create something like a root element. An operation with this identifier is not propagated to other clients. This is why everybode must create the same operation with this uid.
#
(void)
getOperationCounter()
Get the operation counter that describes the current state of the document.
#
(void)
_encode(state_vector = {})
Encode this operation in such a way that it can be parsed by remote peers.
#
(void)
getNextOperationIdentifier(user_id)
Get the number of operations that were created by a user. Accordingly you will get the next operation number that is expected from that user. This will increment the operation counter.
#
(void)
getOperation(uid)
Retrieve an operation from a unique id.
#
(void)
addOperation(o)
Add an operation to the HB. Note that this will not link it against other operations (it wont executed)
#
(void)
addToCounter(o)
Increment the operation_counter that defines the current state of the Engine.