ron-0.9: RON

Safe HaskellNone
LanguageHaskell2010

RON.Event

Synopsis

Documentation

data EpochEvent Source #

Epoch-based Lamport time event, specific case of Event.

type EpochTime = Word60 Source #

RFC 4122 epoch, hundreds of nanoseconds since 1582. Year range is 1582—5235.

data Event Source #

Generic Lamport time event. Cannot be Ord because we can't compare different types of clocks. If you want comparable events, use specific EpochEvent.

Constructors

Event !LocalTime !ReplicaId 
Instances
Eq Event Source # 
Instance details

Defined in RON.Event

Methods

(==) :: Event -> Event -> Bool #

(/=) :: Event -> Event -> Bool #

Show Event Source # 
Instance details

Defined in RON.Event

Methods

showsPrec :: Int -> Event -> ShowS #

show :: Event -> String #

showList :: [Event] -> ShowS #

data LocalTime Source #

Clock type is encoded in 2 higher bits of variety, value in uuidValue

Instances
Eq LocalTime Source # 
Instance details

Defined in RON.Event

Show LocalTime Source # 
Instance details

Defined in RON.Event

data Naming Source #

Replica id assignment style

Instances
Bounded Naming Source # 
Instance details

Defined in RON.Event

Enum Naming Source # 
Instance details

Defined in RON.Event

Eq Naming Source # 
Instance details

Defined in RON.Event

Methods

(==) :: Naming -> Naming -> Bool #

(/=) :: Naming -> Naming -> Bool #

Show Naming Source # 
Instance details

Defined in RON.Event

Hashable Naming Source # 
Instance details

Defined in RON.Event

Methods

hashWithSalt :: Int -> Naming -> Int #

hash :: Naming -> Int #

class Monad m => ReplicaClock m where Source #

Methods

getPid :: m ReplicaId Source #

Get current replica id

getEvents Source #

Arguments

:: EpochTime

number of needed timestamps

-> m [EpochEvent] 

Get sequential timestamps.

Laws:

  1. t <- getEvents n
    (t !! i) == head t + i
    
  2. t1 <- getEvent
    t2 <- getEvent
    t2 >= t1 + 1
    
  3. getEvents 0 == getEvents 1

advance :: EpochTime -> m () Source #

Make local time not less than this

data ReplicaId Source #

Replica identifier

Constructors

ReplicaId !Naming !Word60 
Instances
Eq ReplicaId Source # 
Instance details

Defined in RON.Event

Show ReplicaId Source # 
Instance details

Defined in RON.Event

Generic ReplicaId Source # 
Instance details

Defined in RON.Event

Associated Types

type Rep ReplicaId :: Type -> Type #

Hashable ReplicaId Source # 
Instance details

Defined in RON.Event

type Rep ReplicaId Source # 
Instance details

Defined in RON.Event

advanceToUuid :: ReplicaClock clock => UUID -> clock () Source #

advance variant for any UUID

applicationSpecific :: Word64 -> ReplicaId Source #

Make an ApplicationSpecific replica id from arbitrary number

getEvent :: (HasCallStack, ReplicaClock m) => m EpochEvent Source #

Get a single event

getEventUuid :: ReplicaClock m => m UUID Source #

Get a single event as UUID

getEventUuids :: ReplicaClock m => Word60 -> m [UUID] Source #

Get event sequence as UUIDs

mkCalendarDate Source #

Arguments

:: (Word16, Word16, Word8)

date as (year, month [1..12], day [1..])

-> Maybe CalendarTime 

Make a calendar timestamp from a date

mkCalendarDateTime Source #

Arguments

:: (Word16, Word16, Word8)

date as (year, month [1..12], day [1..])

-> (Word8, Word8, Word8)

day time as (hours, minutes, seconds)

-> Maybe CalendarTime 

Make a calendar timestamp from a date and a day time

mkCalendarDateTimeNano Source #

Arguments

:: (Word16, Word16, Word8)

date as (year, month [1..12], day [1..])

-> (Word8, Word8, Word8)

day time as (hours, minutes, seconds)

-> Word32

fraction of a second in hundreds of nanosecond

-> Maybe CalendarTime 

Make a calendar timestamp from a date, a day time, and a second fraction