Class AtomicMonotonicTimestampGenerator
A timestamp generator that guarantees monotonically increasing timestamps among all client threads and logs warnings when timestamps drift in the future.
Implements
Inherited Members
Namespace: Cassandra
Assembly: Cassandra.dll
Syntax
public class AtomicMonotonicTimestampGenerator : ITimestampGenerator
Constructors
AtomicMonotonicTimestampGenerator(int, int)
Creates a new instance of AtomicMonotonicTimestampGenerator.
Declaration
public AtomicMonotonicTimestampGenerator(int warningThreshold = 1000, int minLogInterval = 1000)
Parameters
Type | Name | Description |
---|---|---|
int | warningThreshold | Determines how far in the future timestamps are allowed to drift before a warning is logged, expressed
in milliseconds. Default: |
int | minLogInterval | In case of multiple log events, it determines the time separation between log events, expressed in
milliseconds. Use 0 to disable. Default: |
Fields
DefaultMinLogInterval
Default time separation between log events (expressed in milliseconds) in case of multiple log events.
Declaration
public const int DefaultMinLogInterval = 1000
Field Value
Type | Description |
---|---|
int |
DefaultWarningThreshold
Default warning threshold in milliseconds.
Declaration
public const int DefaultWarningThreshold = 1000
Field Value
Type | Description |
---|---|
int |
TicksPerMicrosecond
The amount of ticks per microsecond.
Declaration
protected const long TicksPerMicrosecond = 10
Field Value
Type | Description |
---|---|
long |
UnixEpochTicks
The amount of ticks since 1/1/1 to unix epoch.
Declaration
protected static readonly long UnixEpochTicks
Field Value
Type | Description |
---|---|
long |
Methods
GetTimestamp()
Retrieves the current system-clock time in expressed microseconds since UNIX epoch.
Declaration
protected virtual long GetTimestamp()
Returns
Type | Description |
---|---|
long |
Next()
Returns the next timestamp in microseconds since UNIX epoch.
Implementers should enforce increasing monotonic timestamps, that is, a timestamp returned should always be strictly greater that any previously returned timestamp.
Implementers should strive to achieve microsecond precision in the best possible way, which is usually largely dependent on the underlying operating system's capabilities.
Declaration
public long Next()
Returns
Type | Description |
---|---|
long | The next timestamp (in microseconds). When returning System.Int64.MinValue, the driver will not set the timestamp, letting Apache Cassandra generate a server-side timestamp. |