JavaScript is disabled, refresh for a better experience. ambee/giterated

ambee/giterated

Git repository hosting, collaboration, and discovery for the Fediverse.

No last commit found
..
⁨2⁩ years ago
README.md

Giterated Stack

Giterated stack is the unified protocol stack implementation for Giterated. The architecture of the Giterated Stack allows for easy re-use of the same stack handling code across the entire Giterated ecosystem, from daemon to client. This is aided by the aggressive type erasure when using Giterated’s Unified Stack as well as reflection to enable dynamic creation at runtime of an efficient handler stack for Giterated’s protocol.

Architecture

Giterated Stack defines the type GiteratedStack, which contains all the state necessary to handle Giterated Operations into their result. In order to do this, there is a registration process for object types, setting types, value types, operation handlers, and other metadata.

A GiteratedStack is created by merging any number of SubstackBuilders into the GiteratedStack. The creation process is completed once the GiteratedStack is placed within an Arc, leaving it read-only. GiteratedStack is designed to be completely immutable at operation handling time. This means you can access it from any number of threads without concern for lock contention or other similar cases.

Reflection

GiteratedStack uses traits to embed reflection into the binary. GiteratedStack generates this reflection metadata at runtime from traits which are inherent on the types it is reflecting.

This means that if, for example, T: ValueMeta: T also has an implementation of T: IntoValueMeta.

For specifics on what is reflected, how it is reflected, and how the reflection is used, please refer to the implementation of GiteratedStack.

Parallelism

Giterated’s Unified Stack aims to leave compute parallelism to the caller. It contains no internal notion of runtime state, thread pools, etc.

If the caller seeks compute parallelism, they can provide that by calling Giterated’s Unified Stack from as many threads as they wish.

Motivation

The design of the Giterated Unified Stack is intended to create a data structure that represents the entire stack’s state, and then operations are completed using that context. Giterated’s Unified Stack maintains no concept of tasks, threads, or thread pools; rather, Giterated’s Unified Stack exists only as the entire state needed to process an operation into a response.

Implementation