graft.log module¶
-
exception
graft.log.AppendError[source]¶ Bases:
ValueErrorRaised by
append()when an invalidgraft.model.Indexis passed
-
graft.log.append(log, after, *entries)[source]¶ Append entries to log after the given index.
- Parameters
log (
Map) – Log object to append entries to.after (
Index) – Log index after which entries will be appended.
- Raises
If the operation is unsuccessful, which can happen if after index does not exist in the given log. Unless index.key is 0 (the origin). For example:
>>> index = model.Index(key=2, term=4) >>> assert log[2].term == index.term # index and term match existing entry >>> index = model.Index(key=0, term=4) # will work since index it's origin
- Return type
Map