Skip to content

Commit

Permalink
update docs and closing main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
balazskreith committed Aug 8, 2024
1 parent aefb702 commit cfaeeba
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 43 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ HamokRecord is a feature that provides distributed storage for individual record

## User Manual

You can find detailed user manuals [here](www.hamok.dev)
You can find detailed user manuals [here](http://www.hamok.dev)


## Contributing
Expand Down
11 changes: 0 additions & 11 deletions docs/emitter.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
## User Manual
[Hamok](./index.md) | HamokEmitter | [HamokMap](./map.md) | [HamokQueue](./queue.md) | [HamokRecord](./record.md)

## Table of Contents
* [Overview](#overview)
* [API Reference](#api-reference)
* [Create a HamokEmitter instance](#create-a-hamokemitter-instance)
* [Configuration](#configuration)
* [Events](#events)
* [Properties](#properties)
* [Methods](#methods)
* [Examples](#examples)
* [FAQ](#faq)

## Table of Contents
* [Overview](#overview)
* [Configuration](#configuration)
Expand Down
65 changes: 34 additions & 31 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
2. [Installation](#installation)
3. [Configuration](#configuration)
4. [API Reference](#api-reference)
- [Hamok Class](#hamok-class)
- [Executing Tasks on the leader](#executing-tasks-on-the-leader)
- [Creating and Managing Maps](#creating-and-managing-maps)
- [Creating and Managing Records](#creating-and-managing-records)
- [Creating and Managing Queues](#creating-and-managing-queues)
- [Creating and Managing Emitters](#creating-and-managing-emitters)
5. [Events](#events)
- [Properties](#properties)
- [Events](#events)
- [Methods](#methods)
5. [Use Cases](#use-cases)
- [Executing Tasks on the leader](#executing-tasks-on-the-leader)
- [Creating and Managing Maps](#creating-and-managing-maps)
- [Creating and Managing Records](#creating-and-managing-records)
- [Creating and Managing Queues](#creating-and-managing-queues)
- [Creating and Managing Emitters](#creating-and-managing-emitters)
6. [Snapshots](#snapshots)
7. [Error Handling](#error-handling)
8. [Examples](#examples)
Expand Down Expand Up @@ -90,11 +92,9 @@ const config = {
const hamok = new Hamok(config);
```

## API Reference
## API Reference `Hamok`

### `Hamok` Class

#### Properties
### Properties

- `config`: `HamokConfig`
- The configuration object for the Hamok instance.
Expand Down Expand Up @@ -132,7 +132,27 @@ const hamok = new Hamok(config);
- `run`: `boolean`
- A boolean indicating if the Raft timer is running.

#### Methods
### Events

Hamok emits various events that can be listened to for handling specific actions.

- `started`: Emitted when the Hamok instance starts.
- `stopped`: Emitted when the Hamok instance stops.
- `follower`: Emitted when the instance becomes a follower.
- `leader`: Emitted when the instance becomes the leader.
- `message`: Emitted when a message is received.
- `remote-peer-joined`: Emitted when a remote peer joins.
- `remote-peer-left`: Emitted when a remote peer leaves.
- `leader-changed`: Emitted when the leader changes.
- `state-changed`: Emitted when the state changes.
- `commit`: Emitted when a commit occurs.
- `heartbeat`: Emitted during heartbeats.
- `error`: Emitted when an error occurs.
- `hello-notification`: Emitted when a hello notification is received.
- `no-heartbeat-from`: Emitted when no heartbeat is received from a peer.


### Methods

- **constructor**(`providedConfig?: Partial<HamokConstructorConfig>`):
- Creates a new Hamok instance with the provided configuration.
Expand Down Expand Up @@ -179,6 +199,8 @@ const hamok = new Hamok(config);
- **fetchRemotePeers**(`options?: { customRequest?: string, timeoutInMs?: number }`): `Promise<HamokFetchRemotePeersResponse>`
- Fetches remote peers with optional custom requests and timeout.

## Use cases

### Executing Tasks on the leader

```typescript
Expand Down Expand Up @@ -271,25 +293,6 @@ emitter.emit('event');
```


## Events

Hamok emits various events that can be listened to for handling specific actions.

- `started`: Emitted when the Hamok instance starts.
- `stopped`: Emitted when the Hamok instance stops.
- `follower`: Emitted when the instance becomes a follower.
- `leader`: Emitted when the instance becomes the leader.
- `message`: Emitted when a message is received.
- `remote-peer-joined`: Emitted when a remote peer joins.
- `remote-peer-left`: Emitted when a remote peer leaves.
- `leader-changed`: Emitted when the leader changes.
- `state-changed`: Emitted when the state changes.
- `commit`: Emitted when a commit occurs.
- `heartbeat`: Emitted during heartbeats.
- `error`: Emitted when an error occurs.
- `hello-notification`: Emitted when a hello notification is received.
- `no-heartbeat-from`: Emitted when no heartbeat is received from a peer.

## Snapshots

Hamok supports exporting and importing snapshots for persistence and recovery.
Expand Down

0 comments on commit cfaeeba

Please sign in to comment.