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

Create NullDataStore #85

Merged
merged 7 commits into from
Aug 4, 2021
Merged

Create NullDataStore #85

merged 7 commits into from
Aug 4, 2021

Conversation

MikkelPaulson
Copy link
Collaborator

In order to rough in save/load logic, we need something to (pretend to) save/load to. The NullDataStore can do that.

This also refactors the old Context struct into a new AppMeta struct that contains literally everything the app knows, including the RNG and DataStore.

Tacked the storage backend onto app, coded with a boring ol'
NullDataStore for the moment. Further changes will be required to fully
parameterize the types.
There's really no distinction between the random crap dumped into
Context and the stuff directly in App. We still want a child struct so
that we can guard ownership a bit, but there's no reason not to
consolidate the various fields of Context.
StepRng was a pain to get random-looking data from, and required the use
of traits at levels where traits really weren't necessary. Switched all
tests to use SmallRng with a hard-coded seed instead, matching the
application logic that uses SmallRng with a random seed.

(This may break in the future if SmallRng changes algorithms, but we can
cross that bridge when we get to it.)
Avoid ownership issues by using a temp variable, the same way npc does.
AppMeta is becoming a catch-all container for all app metadata, removing
the arbitrary Context/App separation.
The entire point of this exercise, moved data_store into AppMeta (as a
dyn thingummy, natch). This will allow us to query the underlying
database from the command level without adding yet another parameter to
the Runnable trait.
Now initiative_core accepts a data store provided by other crates, an
important step to being able to break out storage behaviour by
enviroment.
@MikkelPaulson MikkelPaulson mentioned this pull request Aug 4, 2021
11 tasks
@MikkelPaulson MikkelPaulson merged commit f6ccc0f into main Aug 4, 2021
@MikkelPaulson MikkelPaulson deleted the create-data-store branch August 4, 2021 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant