-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(store-indexer, store-sync): improve query performance and enable…
… compression, add new api (#2026) Co-authored-by: Kevin Ingersoll <[email protected]>
- Loading branch information
Showing
33 changed files
with
544 additions
and
83 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,7 @@ | ||
--- | ||
"@latticexyz/common": minor | ||
--- | ||
|
||
- Added a `Result<Ok, Err>` type for more explicit and typesafe error handling ([inspired by Rust](https://doc.rust-lang.org/std/result/)). | ||
|
||
- Added a `includes` util as typesafe alternative to [`Array.prototype.includes()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes). |
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,22 @@ | ||
--- | ||
"@latticexyz/store-indexer": minor | ||
"@latticexyz/store-sync": minor | ||
--- | ||
|
||
- Improved query performance by 10x by moving from drizzle ORM to handcrafted SQL. | ||
- Moved away from `trpc` for more granular control over the transport layer. | ||
Added an `/api/logs` endpoint using the new query and gzip compression for 40x less data transferred over the wire. | ||
Deprecated the `/trpc/getLogs` and `/trpc/findAll` endpoints. | ||
- Added a `createIndexerClient` client for the new `/api` indexer API exported from `@latticexyz/store-sync/indexer-client`. | ||
The `createIndexerClient` export from `@latticexyz/store-sync/trpc-indexer` is deprecated. | ||
|
||
```diff | ||
- import { createIndexerClient } from "@latticexyz/store-sync/trpc-indexer"; | ||
+ import { createIndexerClient } from "@latticexyz/store-sync/indexer-client"; | ||
|
||
- const indexer = createIndexerClient({ url: "https://indexer.holesky.redstone.xyz/trpc" }); | ||
+ const indexer = createIndexerClient({ url: "https://indexer.holesky.redstone.xyz" }); | ||
|
||
- const snapshot = indexer.getLogs.query(options); | ||
+ const snapshot = indexer.getLogs(options); | ||
``` |
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,5 +1,5 @@ | ||
{ | ||
"31337": { | ||
"address": "0x6e9474e9c83676b9a71133ff96db43e7aa0a4342" | ||
"address": "0x2ea123a56f2e986c9844bf4dc13050c4df200b29" | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,10 @@ | ||
// Inspired by https://doc.rust-lang.org/std/result/ | ||
export type Result<Ok, Err = unknown> = { ok: Ok } | { error: Err }; | ||
|
||
export function isOk<Ok, Err>(result: Result<Ok, Err>): result is { ok: Ok } { | ||
return "ok" in result; | ||
} | ||
|
||
export function isError<Ok, Err>(result: Result<Ok, Err>): result is { error: Err } { | ||
return "error" in result; | ||
} |
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,3 @@ | ||
export function includes<item>(items: item[], value: any): value is item { | ||
return items.includes(value); | ||
} |
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
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.