- 
                Notifications
    You must be signed in to change notification settings 
- Fork 20
External Entry Points
Entry points are the places where control flow is expected to move from the package user to the package, and vice versa. Input points are places where control flow moves from the package user to the package. Most input points are functions on interfaces implemented by the package (e.g. the Hyperdrive interface). Output points are places where control flow moves from the package to the package user. These are usually defined as callbacks: functions or interfaces defined by the package user to alter the behaviour of the package without needing to alter the package.
Hyperdrive uses this pattern of input/output points to communicate between packages (for example, package hyperdrive should be considered a package user of package replica). However, this page discusses external entry points, where the package user is external to the Hyperdrive codebase. These package users are called external package users (e.g. a codebase that implements a blockchain using Hyperdrive consensus is an external package user).
| Package | Interface | Func | Point | Description | 
|---|---|---|---|---|
| hyperdrive | Hyperdrive | New | input | |
| hyperdrive | Hyperdrive | Start | input | |
| hyperdrive | Hyperdrive | Rebase | input | 
| Package | Interface | Point | Description | 
|---|---|---|---|
| hyperdrive | BlockIterator | output | Implementing BlockIteratorallows the external package user to control the building of a proposedBlock. Hyperdrive calls out to thisinterfacewhenever it needs to propose aBlock. | 
| hyperdrive | Validator | output | Implementing Validatorallows the external package user to control the validation of a proposedBlock. Hyperdrive calls out to thisinterfacewhenever it needs to validate aBlock. The existence of thisinterfaceis necessary, given that the external package user is able to implementBlockIterator. | 
| hyperdrive | Observer | output | Implementing Observerallows the external package user to react to interesting consensus events. Hyperdrive calls out to thisinterfacewhenever an interesting consensus event is triggered (for example, when aBlockis committed). | 
| Package | Interface | Func | Point | Description | 
|---|---|---|---|---|
| hyperdrive | Hyperdrive | HandleMessage | input | HandleMessageshould be called by the external package user whenever a message has been received over the network. | 
| hyperdrive | Broadcaster | Broadcast | output | Hyperdrive will call Broadcastwhenever it is trying to send a message from one instance to another instance over the network. Different external implementations ofBroadcastercan be used to support different types of networks. For example, achanbased implementation is used in testing to define a simple in-memory network. In practice, an implementation that abstracts overawis used. | 
| Package | Interface | Point | Description | 
|---|---|---|---|
| hyperdrive | ProcessStorage | output | Implementing ProcessStorageallows the external package user to define the storage driver forProcessState. The external package user is expected to use the JSON/binary (un)marshaling functionality available on most Hyperdrive types to save/restore data to/from the disk. In practice, an implementation that abstracts overkvis used. | 
| hyperdrive | BlockStorage | output | Implementing BlockStorageallows the external package user to define the storage driver forBlocks. Hyperdrive calls out to thisinterfacewhenever it needs to accessBlocksfrom a specificShard. Thisinterfaceis aware of the specificShard, and returns implementations ofBlockchainthat are bound to a specificShard. The external package user is expected to use the JSON/binary (un)marshaling functionality available on most Hyperdrive types to save/restore data to/from the disk. In practice, an implementation that abstracts over kv is used. | 
| hyperdrive | Blockchain | output | Implementing Blockchcainallows the external package user to define the storage driver forhyperdrive.Blocks. Hyperdrive calls out to thisinterfacewhenever it needs to accessBlocksat specific heights. Implementations of thisinterfacemust be bound to a specificShard. In practice, an implementation that abstracts overkvis used. |