-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(store-sync,store-indexer): consolidate sync logic, add syncToSql…
…ite (#1240)
- Loading branch information
Showing
24 changed files
with
439 additions
and
353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@latticexyz/dev-tools": patch | ||
"@latticexyz/store-indexer": minor | ||
"@latticexyz/store-sync": minor | ||
--- | ||
|
||
Store sync logic is now consolidated into a `createStoreSync` function exported from `@latticexyz/store-sync`. This simplifies each storage sync strategy to just a simple wrapper around the storage adapter. You can now sync to RECS with `syncToRecs` or SQLite with `syncToSqlite` and PostgreSQL support coming soon. | ||
|
||
There are no breaking changes if you were just using `syncToRecs` from `@latticexyz/store-sync` or running the `sqlite-indexer` binary from `@latticexyz/store-indexer`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
import { assertExhaustive } from "@latticexyz/common/utils"; | ||
import { StoreEventsAbiItem } from "@latticexyz/store"; | ||
import { StoreConfig } from "@latticexyz/store"; | ||
import { StorageOperation } from "@latticexyz/store-sync"; | ||
|
||
type Props = { | ||
eventName: StoreEventsAbiItem["name"]; | ||
type: StorageOperation<StoreConfig>["type"]; | ||
}; | ||
|
||
export function EventIcon({ eventName }: Props) { | ||
switch (eventName) { | ||
case "StoreSetRecord": | ||
export function EventIcon({ type }: Props) { | ||
switch (type) { | ||
case "SetRecord": | ||
return <span className="text-green-500 font-bold">=</span>; | ||
case "StoreSetField": | ||
case "SetField": | ||
return <span className="text-cyan-500 font-bold">+</span>; | ||
case "StoreDeleteRecord": | ||
case "DeleteRecord": | ||
return <span className="text-red-500 font-bold">-</span>; | ||
case "StoreEphemeralRecord": | ||
return <span className="text-violet-400 font-bold">~</span>; | ||
// case "EphemeralRecord": | ||
// return <span className="text-violet-400 font-bold">~</span>; | ||
default: | ||
return assertExhaustive(eventName, `Unexpected event name: ${eventName}`); | ||
return assertExhaustive(type, `Unexpected storage operation type: ${type}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export enum SyncStep { | ||
INITIALIZE = "initialize", | ||
SNAPSHOT = "snapshot", | ||
RPC = "rpc", | ||
LIVE = "live", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.