NESTS - Named Entities in Simple Tiered Spaces

The main transaction loop

The transaction loop is the heart of the NESTS mechanism, fetching, interpreting and executing queued instructions.

The transaction loop runs continuously while the active flag is true.

While the transaction queue file is open for retrieval of the queued instructions, the queue lock flag is true. Any instructions appended to the transaction queue at this time will be appended to a temporary queue buffer instead.



At the next opportunity (when the queue lock flag is false) the entire queue buffer is appended to the transaction queue file.

Instructions scheduled, whether locally incoming from another hub, are appended to the iqueue_local file if not locked or to the iqueue_buffer file otherwise.




Each instruction line in the transaction queue comprises:

  • date and time (YYYY-MM-DD_hh:mm:ss:ms)
  • Unix time
  • transaction number
  • from_account (FPH)
  • to_account (FPH)
  • operation type: see Table 1
  • value type: see Table 1
  • annotation

Upon retrieval from the transaction queue, the operation is executed.


Each time an instruction operates upon an account, a transaction record (a.k.a. "journal entry") is written:

  • date and time (YYYY-MM-DD_hh:mm:ss:ms)
  • Unix time
  • transaction number
  • target_account (FPH): the account to which this transaction (journal) record belongs
  • other_account (FPH): the other account affected by this operation
  • operation type: see Table 1
  • value type: see Table 1
  • value of the target account following the operation:
  • annotation

Each time an instruction operates upon a currency, a transaction record (a.k.a. "journal entry") is written:

  • date and time (YYYY-MM-DD_hh:mm:ss:ms)
  • Unix time
  • transaction number
  • target_account (FPH): the account to which this transaction (journal) record belongs
  • other_account (FPH): the other account affected by this operation
  • operation type: see Table 1
  • value type: see Table 1
  • value of the target account following the operation:
  • annotation


Table 1: opcodes in instruction queue
mnemonic
opcode
account1 type value2
passed
instruction/operation target other
credit3 payment money4 money
debit3 payment money4 money
i=I set integer value integer4 integer
i++ integer/count increment integer4
i-- integer/count decrement integer4
v=v set vector value vector5 vector
v=V set vector value vector5 vector
m=m set matrix value matrix5 matrix
m=M set matrix value matrix5 matrix
s+=s add scalar to scalar scalar4 scalar
v+=v add vector to vector vector5 vector
v+=V add vector to vector vector5 vector
m+=m add matrix to matrix matrix5 matrix
m+=M add matrix to matrix matrix5 matrix
s*=s multiply scalar by scalar scalar4 scalar
v*=s multiply vector by scalar vector5 scalar
m*=s multiply matrix by scalar matrix5 scalar4
s/=s divide scalar by scalar scalar4 scalar4
v/=s divide vector by scalar vector5 scalar4
m/=s divide matrix by scalar matrix5 scalar4
m*=v multiply matrix by vector matrix5 vector5
m*=V multiply matrix by vector matrix5 vector5
v*=m multiply vector by matrix vector5 matrix5
v*=M multiply vector by matrix vector5 matrix5
m*=m multiply matrix by matrix matrix5 matrix5
m*=M multiply matrix by matrix matrix5 matrix5
v-=v subtract vector from vector vector5 vector5
v-=V subtract vector from vector vector5 vector5
m-=m subtract matrix from matrix matrix5 matrix5
m-=M subtract matrix from matrix matrix5 matrix5
s>T append scalar to time series FPH6 scalar
v>E append vector to t.s. ensemble FPH6 vector
A:C:P=v set A:C:P ratios FPH7 vector
A:C:P=V set A:C:P ratios FPH7 vector
A:C:P+=v add vector to A:C:P ratios FPH7 vector
  1. Accounts are identified by FPH.
  2. Value passed as parameter rather than account FPH.
  3. A payment is performed using two distinct operations, each queued separately. This approach enables a payment to be made between accounts on different hubs.

    In order to ensure that the two payment operations can be associated unambiguously, they are assigned the same transaction number.

  4. The scalar types may be integers or floating point numbers, simply following the conventions recognized in JSON. This is to simplify compatibility with the compound types (vector or matrix) represented by JSON structures.

    The scalar types include:

    • integer
    • floating point
    • money (fixed point)

  5. With the exception of time series, all compound data types are represented internally as JSON structures.

  6. A time series may be a very large data set, and a time series ensemble will be considerably larger, so the the only practical way to represent these is as a file. The file may be held within the NESTS hub or externally.

    If held internally, the path to the file must be known. If held externally (which is far more realistic for very large data sets) the location (URI) and access credentials (typically SSH, but not necessarily) must be known. Either way, the access can reduced to one level of indirection by using the FPH.


Version 0.0.10 - 2023-01-12 16:45 - Copyright © 2023, 2022, 2021 John Waters


home