Skip to content

Conversation

@AmeanAsad
Copy link
Contributor

Description

This PR addresses: https://github.com/filecoin-saturn/project-tracking/issues/161

The PR changes the storage interface to act as a factory function for storage. This means when we inject storage as a dependency, it returns a function which initiates the storage vs returning the storage getters, setters, etc. right away.

What this improves:

  • Any smart client functionality relies on some form of storage dependency to work. If we inject a storage dependency that is faulty, we must detect that as early as possible and replace it with a memory storage instance.
  • This allows us to catch issues with storage loading before attempting to utilize any storage functionality.

@AmeanAsad AmeanAsad requested a review from guanzo January 17, 2024 15:53
Copy link
Collaborator

@guanzo guanzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the only change we need is to wrap the factory function call in a try/catch and make sure we fallback to memory storage if it errors or is missing. The rest of the changes that add inner functions aren't needed imo.

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.

3 participants