mock

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package mock provides a mock implementation for the accounting interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAccounting

func NewAccounting(opts ...Option) accounting.Interface

NewAccounting creates the mock accounting implementation

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is the option passed to the mock accounting service

func WithCreditFunc

func WithCreditFunc(f func(ctx context.Context, peer boson.Address, traffic uint64) error) Option

WithCreditFunc sets the mock Credit function

func WithDebitFunc

func WithDebitFunc(f func(peer boson.Address, traffic uint64) error) Option

WithDebitFunc sets the mock Debit function

func WithReserveFunc

func WithReserveFunc(f func(peer boson.Address, traffic uint64) error) Option

WithReserveFunc sets the mock Reserve function

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the mock Accounting service.

func (*Service) Credit

func (s *Service) Credit(ctx context.Context, peer boson.Address, traffic uint64) error

Credit is the mock function wrapper that calls the set implementation

func (*Service) Debit

func (s *Service) Debit(peer boson.Address, traffic uint64) error

Debit is the mock function wrapper that calls the set implementation

func (*Service) Reserve

func (s *Service) Reserve(peer boson.Address, traffic uint64) error

Reserve is the mock function wrapper that calls the set implementation

Jump to

Keyboard shortcuts

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