-
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.
Merge remote-tracking branch 'origin/main' into yonadaaa/encapsulate-…
…functionality
- Loading branch information
Showing
27 changed files
with
324 additions
and
268 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,5 @@ | ||
--- | ||
"@latticexyz/world-modules": patch | ||
--- | ||
|
||
Removed `IUniqueEntitySystem` in favor of calling `getUniqueEntity` via `world.call` instead of the world function selector. This had a small gas improvement. |
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/world": patch | ||
--- | ||
|
||
Systems are expected to be always called via the central World contract. | ||
Depending on whether it is a root or non-root system, the call is performed via `delegatecall` or `call`. | ||
Since Systems are expected to be stateless and only interact with the World state, it is not necessary to prevent direct calls to the systems. | ||
However, since the `CoreSystem` is known to always be registered as a root system in the World, it is always expected to be delegatecalled, | ||
so we made this expectation explicit by reverting if it is not delegatecalled. |
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
File renamed without changes.
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,37 @@ | ||
import { Middleware } from "koa"; | ||
|
||
type HealthcheckOptions = { | ||
isHealthy?: () => boolean; | ||
isReady?: () => boolean; | ||
}; | ||
|
||
/** | ||
* Middleware to add Kubernetes healthcheck endpoints | ||
*/ | ||
export function healthcheck({ isHealthy, isReady }: HealthcheckOptions = {}): Middleware { | ||
return async function healthcheckMiddleware(ctx, next): Promise<void> { | ||
if (ctx.path === "/healthz") { | ||
if (isHealthy == null || isHealthy()) { | ||
ctx.status = 200; | ||
ctx.body = "healthy"; | ||
} else { | ||
ctx.status = 503; | ||
ctx.body = "not healthy"; | ||
} | ||
return; | ||
} | ||
|
||
if (ctx.path === "/readyz") { | ||
if (isReady == null || isReady()) { | ||
ctx.status = 200; | ||
ctx.body = "ready"; | ||
} else { | ||
ctx.status = 503; | ||
ctx.body = "not ready"; | ||
} | ||
return; | ||
} | ||
|
||
await next(); | ||
}; | ||
} |
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,12 @@ | ||
import { Middleware } from "koa"; | ||
|
||
export function helloWorld(): Middleware { | ||
return async function helloWorldMiddleware(ctx, next): Promise<void> { | ||
if (ctx.path === "/") { | ||
ctx.status = 200; | ||
ctx.body = "emit HelloWorld();"; | ||
return; | ||
} | ||
await next(); | ||
}; | ||
} |
Oops, something went wrong.