6/HLC

Hybrid Logical Clocks

draft

This specification describes the use of Hybrid Logical Clocks in Eventsourcing.

HLC captures the causality relationship like logical clocks, and enables easy identification of consistent snapshots in distributed systems. Dually, HLC can be used in lieu of physical/NTP clocks since it maintains its logical clock to be always close to the NTP clock.

License

Copyright (c) 2016 Yurii Rashkovskii

This Specification is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This Specification is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, see http://www.gnu.org/licenses.

Language

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

0. Goals

The goals of this specification are:

  • To indicate areas of hybrid logical clocks use.
  • To provide a standard way to serialize hybrid logical clocks.

1. Timestamping

HLC timestamps SHALL BE used to indicate causal and temporal relationship between events and commands.

Event En generated by a command C, MUST have a timestamp greater than the timestamp of C.

Event En+1 MUST have a timestamp greater or equal to the timestamp of En.

2. Layout

HLC timestamp is not a basic type defined in 1/ELF and follows the general layout model, defined as:

  • Layout name: rfc.eventsourcing.com/spec:6/HLC/#Timestamp
Name Type
logicalTime Long
logicalCounter Long

3. Encodings

3.1. Binary Encoding

Binary encoding of an HLC timestamp must follow 2/BES for layouts.

results matching ""

    No results matching ""