dcrd/blockchain/internal/spendpruner/interface.go
Donald Adu-Poku 723d86274b multi: synchronize spend prunes and notifications.
- This updates the spend pruner to use a single notification
channel to keep the order and processing of connectiong
and disconnections deterministic.
- The process lock is now held when spend journal entries
being removed by the pruner to ensure.
- The spend pruners lifecycle process uses an unbuffered
channel to recieve and process notifications. Notifications are
sent via goroutines to avoid blocking as a result.
- Comment related wrapping issues have been resolved.
2021-09-14 16:26:51 -05:00

23 lines
645 B
Go

// Copyright (c) 2021 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package spendpruner
import (
"github.com/decred/dcrd/chaincfg/chainhash"
)
// SpendConsumer describes the requirements for implementing a spend journal
// consumer.
//
// All functions MUST be safe for concurrent access.
type SpendConsumer interface {
// ID returns the identifier of the consumer.
ID() string
// NeedSpendData checks whether the associated spend journal entry for the
// provided block hash will be needed by the consumer.
NeedSpendData(hash *chainhash.Hash) (bool, error)
}