dealer

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package dealer

The `New` function type is intended to be implemented by your dealer plugin to integrate with the Hive application. When creating your plugin, ensure that the constructor function matches the signature of the `New` type. Additionally, export the above symbols so that they can be loaded dynamically by the Hive application at runtime.

Example usage of an example plugin:

package main

import "context"
import "hive/dealer"

// MyDealer implements the Dealer interface.
type MyDealer struct { ... }

// DealMatched is the method that processes matched deals.
func (d *MyDealer) DealMatched(dealID string) { ... }

// DealsAgreed is the method that provides a channel of agreed deals.
func (d *MyDealer) DealsAgreed() <-chan string { ... }

// New creates a new instance of MyDealer.
func New(ctx context.Context) Dealer {
    return &MyDealer{ ... }
}

For more examples refer: https://github.com/CoopHive/hive/blob/main/exp/dealer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dealer

type Dealer interface {
	// DealMatched processes a deal identified by its unique ID.
	DealMatched(dealID string)

	// DealsAgreed returns a read-only channel that emits IDs of deals that have been agreed upon.
	DealsAgreed() <-chan string
}

Dealer defines the interface for a plugin that manages deals within the Hive application. Implementations of this interface are expected to handle matched deals and provide a channel for agreed deals.

type New added in v0.5.0

type New func(ctx context.Context) Dealer

New is a constructor type for creating new instances of the Dealer interface. It takes a context and returns an implementation of the Dealer interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL