Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worker #100

Merged
merged 20 commits into from
Jan 5, 2024
Merged

Worker #100

merged 20 commits into from
Jan 5, 2024

Conversation

mariari
Copy link
Member

@mariari mariari commented Dec 27, 2023

A simple worker node and corresponding tests

This will be important as Nock gets scry, as it will need to know
where to read from, and the meta table will have fields that talk
about which tables scry ought to read from magically
This reflects the general idea that this represnets environmental
information, with jettedness being a apart of this
@mariari mariari force-pushed the mariari/worker branch 2 times, most recently from eff87de to 48ebfda Compare December 28, 2023 07:41
@mariari mariari marked this pull request as ready for review December 28, 2023 07:42
@mariari mariari force-pushed the mariari/worker branch 5 times, most recently from ac9d5d5 to 386fbef Compare December 31, 2023 03:33
This serves as the basis for what a real order would expect the format
to be.

Making this an explicit type makes it easy to refactor the intenral
representation without having to go and change every instance of it
@mariari mariari force-pushed the mariari/worker branch 2 times, most recently from 960e1b8 to 6ea05c4 Compare December 31, 2023 13:08
mariari added 17 commits January 1, 2024 17:29
We remove all known warnings, this makes it nice as `mix test` and
other commands will not spit any wanrings anymore
This ensures that the db is initialized before we run any tests. This
matters in a lot of topics that require the DB to be online
This module consists of two parts:
1. An ordering map which tells of the latest order in the
   qualification map
2. A qualification map which maps from a qualified key to the stored
   value

Further we provide types for everything so the code can be somewhat
grocked by looking at the types
We test:

1. reads
2. blocking_reads
3. puts
4. blocking_reads with data not in yet
The intended strategy is to hold a current order and cache of ids to
orders, to better get timestamps of the keyspace

This is highly inefficient but is the best we can do without
partitioning the key_space explicitly somehow
As we can see by running:

mix test --cover

we end up testing most of the module, with just a few basic calls, the
ordering system is quite simple, and one can just take a number to
figure out where they are next in line

Percentage | Module
-----------|--------------------------
    60.00% | Anoma.Node.Storage
    92.86% | Anoma.Node.Storage.Communicator
    96.43% | Anoma.Node.Storage.Ordering
With this, we have a very slow way of effectively slowly snapshotting
the database.

Very slow, someone should do a better method than what I'm doing here
Currently this caller blocking APΙ only has
  - `caller_blocking_read_id/2`
  - `caller_blocking_read_id/3`

However these are the key functions needed to implementing scry like
behavior
This makes sure that the logic for reading at an ID is fairly stable
and works as intended
Scry gets a snapshot from storage and from there indexs into the
proper keys
This helps when other files need to use these definitions
I implement the increment function and test out that scrying indeed works
This worker just waits to write to the database, blocking on both
reading and writing
We do this by acting as the mempool by hand and telling it what order
to execute the workers in
@juped juped merged commit b8076c8 into base Jan 5, 2024
2 checks passed
@mariari mariari deleted the mariari/worker branch July 20, 2024 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants