3.4.1 • Published 8 months ago

@actyx/pond v3.4.1

Weekly downloads
122
License
GPL-2.0-only
Repository
github
Last release
8 months ago

An open-source Typescript/Javascript framework for implementing distributed state-machines which are automatically kept in sync across a swarm of interconnected devices. The Actyx Pond requires Actyx to be running on each device.

The key features of Actyx Pond are:

  • Distributed event-sourcing for great information replication facilities and declarative information consumption
  • Partition tolerance with an eventually consistent programming model for arbitrary business logic
  • Eventual consistency by using a state machine time-travel algorithm to agree on global state

This package builds on the Actyx SDK.

Example usage

import { Pond, Tag, Fish, FishId } from '@actyx/pond'
(async () => {

    // Connect to the local Actyx process
    const pond = await Pond.default({
        appId: 'com.example.app',
        displayName: 'Example App',
        version: '1.0.0'
    })


    const chatTag = Tag<string>('ChatMessage');
    // A fish is a state machine
    const ChatFish: Fish<string[], string> = {
        fishId: FishId.of('chat', 'MyChatFish', 0),
        initialState: [],
        onEvent: (state, event) => {
            state.push(event);
            return state;
        },
        where: chatTag,
    };

    // Example event emission; this can actually
    // happen on any node running Actyx
    setInterval(() => {
        pond.emit(chatTag, 'a chat message')
    }, 2_000)

    // Observe time-travelling state machine
    pond.observe(ChatFish, (state) => {
        console.log(state)
    })

})()

Recommended VSCode plugins

  • ESLint for live source code linting
3.4.1

8 months ago

3.4.0

1 year ago

3.3.2

1 year ago

3.3.1

2 years ago

3.3.0

2 years ago

3.2.2

2 years ago

3.2.1

2 years ago

3.2.0

2 years ago

3.1.3-rc3

2 years ago

3.2.3

2 years ago

3.1.3-rc2

2 years ago

3.1.3

2 years ago

3.1.3-rc1

2 years ago

3.1.2

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

3.0.0-beta1

3 years ago

3.0.0-beta0

3 years ago

2.7.0

3 years ago

2.6.0

3 years ago

2.5.2

3 years ago

2.5.1

3 years ago

2.5.0

3 years ago

2.4.1

3 years ago

2.4.0

3 years ago

2.3.0

3 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

2.0.0-rc1

4 years ago

1.2.0-rc2

4 years ago

1.2.0-rc1

4 years ago

1.2.0-alpha3

4 years ago

1.2.0-alpha2

4 years ago

1.2.0-alpha0

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.0-alpha.7

4 years ago

1.0.0-alpha.6

4 years ago

1.0.0-alpha.5

4 years ago

1.0.0-alpha.4

4 years ago

1.0.0-alpha.3

4 years ago

1.0.0-alpha.2

4 years ago

1.0.0-alpha.1

4 years ago

1.0.0-alpha.0

4 years ago

0.1.0

4 years ago