Skip to content

Integrate statesPub interface into client. #197

@manoranjith

Description

@manoranjith

Location

[client]

Context

Refactor of watcher for IoT use cases is described in umbrella issue: #172. To integrate the refactored watcher into the client, each channel should publish the off-chain transactions to the watcher via StatesPub interface.

type StatesPub interface {
    Publish(channel.Transaction) error
}

Details

New states are created for the Channel when enabling newer off-chain states. In this place, the newer state should be published to the watcher.

However, the statesPub instance will be available only after a channel is initialized and the client registers the channel with the watcher. Therefore,

  1. Add a field Publisher with type func(channel.Transaction) error to the client.Channel type.
  2. Implement a NoopPublisher that always returns nil.
  3. When initializing the channel, set the Publisher to a NoopPublisher.
  4. Publish the states on the Publisher when enabling newer off-chain states.

In an upcoming pull request, NoopPublisher will be replaced by the Publisher associated with the watcher when client registers the channel with the watcher.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions