api.go 408 Bytes
Newer Older
1 2 3 4 5 6 7 8
package rpc

import (
	"context"
)

type batcherClient interface {
	Start() error
9
	Stop(ctx context.Context) error
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
}

type adminAPI struct {
	b batcherClient
}

func NewAdminAPI(dr batcherClient) *adminAPI {
	return &adminAPI{
		b: dr,
	}
}

func (a *adminAPI) StartBatcher(_ context.Context) error {
	return a.b.Start()
}

26 27
func (a *adminAPI) StopBatcher(ctx context.Context) error {
	return a.b.Stop(ctx)
28
}