top

Package transaction deals with the back and forth between the master and slave, and keeps track of the different tims and offsets that they give each other

A transaction consists of a set of multiple messages between the slave and master, each containing the current time and their diff from the time delivered previously. Using this data an average offset between the two can be determined, taking into account RTT between the two endpoints.

A transaction is started when a slave calls Initiate to set up a new transaction and receive the first message it should send to the master. Once the master sends back a response, this should be given to IncomingMessage, which will return another message to send to the master, and so on.

On the master's side, when it receives a message from any slave it should pass that message into IncomingMessage, which will set up the necessary transaction data if necessary and return a response message. If it returns nil the transaction is completed and nothing needs to be sent.

Imports 3 package(s)

  1. github.com/levenlabs/saturn/config
  2. github.com/levenlabs/saturn/proto
  3. github.com/levenlabs/go-llog

Test imports 3 package(s)

  1. github.com/levenlabs/golib/testutil
  2. github.com/stretchr/testify/assert
  3. github.com/stretchr/testify/require