Skip to content
This repository has been archived by the owner on Sep 21, 2024. It is now read-only.

feat: Introduce Importable/Exportable Storage traits. #633

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jsantell
Copy link
Contributor

No description provided.

rust/noosphere-storage/src/exportable.rs Outdated Show resolved Hide resolved
rust/noosphere-storage/src/exportable.rs Outdated Show resolved Hide resolved
rust/noosphere-storage/src/exportable.rs Outdated Show resolved Hide resolved
@jsantell jsantell force-pushed the dbmigration branch 2 times, most recently from 8af27db to edcf475 Compare September 18, 2023 21:23
@jsantell
Copy link
Contributor Author

  • ImportStorage and ExportStorage traits for storages to pipe entries to another. A Storage is exportable if <S as Storage>::KeyValueStore: IterableStore. Any storage with a writable store <S as Storage>::KeyValueStore: Store can import. MemoryStorage, IndexedDbStorage, and SledStorage can be exported.
  • A few generic storage operators: OpenStorage, RenameStorage, RemoveStorage. A generic open utility is valuable in tests alone, and other functions generic over storage, the others only used for migrating. A trait FsBackedStorage can be implemented, providing a blanket implementation to these operators.
  • While IndexedDbStorage is exportable, a storage rename (hard copy) isn't ideal. While there are tests for exporting indexedDB, not yet handling migrating on the web without a destination format in mind (other than MemoryStore)
  • The remaining bits are probing existing storage to learn the type/version if it exists to explicitly use DB types during migration.
  • Names are murky for now; open to suggestions on FsBackedStorage, and any consistencies of storage-based traits; e.g. OpenStorage etc. (verb+Storage) seems to fit the bill in most cases (whereas Importable and Exportable kind of mean the same thing)

@jsantell jsantell force-pushed the dbmigration branch 5 times, most recently from f8ee62a to e12d9d5 Compare September 19, 2023 17:26
@jsantell jsantell marked this pull request as ready for review September 19, 2023 17:43
@jsantell jsantell requested a review from cdata September 19, 2023 17:46
@jsantell
Copy link
Contributor Author

Ready for review; would like to do the final bits in a follow up within noosphere where we determine if a migration is needed, what storage types are being involved, and any record keeping (db version/type), and actually enable the path

rust/noosphere-storage/src/migration.rs Outdated Show resolved Hide resolved
rust/noosphere-storage/src/migration.rs Outdated Show resolved Hide resolved
@jsantell jsantell force-pushed the dbmigration branch 3 times, most recently from a0176f2 to a26fd83 Compare September 20, 2023 22:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant