ceremonyclient/types/p2p/pubsub.go
Cassandra Heart 12996487c3
v2.1.0.18 (#508)
* experiment: reject bad peer info messages

* v2.1.0.18 preview

* add tagged sync

* Add missing hypergraph changes

* small tweaks to sync

* allow local sync, use it for provers with workers

* missing file

* resolve build error

* resolve sync issue, remove raw sync

* resolve deletion promotion bug

* resolve sync abstraction leak from tree deletion changes

* rearrange prover sync

* remove pruning from sync

* restore removed sync flag

* fix: sync, event stream deadlock, heuristic scoring of better shards

* resolve hanging shutdown + pubsub proxy issue

* further bugfixes: sync (restore old leaf sync), pubsub shutdown, merge events

* fix: clean up rust ffi, background coverage events, and sync tweaks

* fix: linking issue for channel, connectivity test aggression, sync regression, join tests

* fix: disjoint sync, improper application of filter

* resolve sync/reel/validation deadlock

* adjust sync to handle no leaf edge cases, multi-path segment traversal

* use simpler sync

* faster, simpler sync with some debug extras

* migration to recalculate

* don't use batch

* square up the roots

* fix nil pointer

* fix: seniority calculation, sync race condition, migration

* make sync dumber

* fix: tree deletion issue

* fix: missing seniority merge request canonical serialization

* address issues from previous commit test

* stale workers should be cleared

* remove missing gap check

* rearrange collect, reduce sync logging noise

* fix: the disjoint leaf/branch sync case

* nuclear option on sync failures

* v2.1.0.18, finalized
2026-02-08 23:51:51 -06:00

71 lines
2.0 KiB
Go

package p2p
import (
"context"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/multiformats/go-multiaddr"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/wrapperspb"
"source.quilibrium.com/quilibrium/monorepo/go-libp2p-blossomsub/pb"
"source.quilibrium.com/quilibrium/monorepo/protobufs"
)
type ValidationResult int
const (
ValidationResultAccept ValidationResult = iota
ValidationResultReject
ValidationResultIgnore
)
type PubSub interface {
// SetShutdownContext allows the caller to provide a context that, when
// cancelled, will trigger graceful shutdown of the pubsub subscription
// loops. This should be called before subscribing to any bitmasks.
SetShutdownContext(ctx context.Context)
Close() error
PublishToBitmask(bitmask []byte, data []byte) error
Publish(address []byte, data []byte) error
Subscribe(bitmask []byte, handler func(message *pb.Message) error) error
Unsubscribe(bitmask []byte, raw bool)
RegisterValidator(
bitmask []byte,
validator func(peerID peer.ID, message *pb.Message) ValidationResult,
sync bool,
) error
UnregisterValidator(bitmask []byte) error
GetPeerID() []byte
GetPeerstoreCount() int
GetNetworkPeersCount() int
GetRandomPeer(bitmask []byte) ([]byte, error)
GetMultiaddrOfPeerStream(
ctx context.Context,
peerId []byte,
) <-chan multiaddr.Multiaddr
GetMultiaddrOfPeer(peerId []byte) string
GetOwnMultiaddrs() []multiaddr.Multiaddr
StartDirectChannelListener(
key []byte,
purpose string,
server *grpc.Server,
) error
GetDirectChannel(
ctx context.Context,
peerId []byte,
purpose string,
) (*grpc.ClientConn, error)
GetNetworkInfo() *protobufs.NetworkInfoResponse
SignMessage(msg []byte) ([]byte, error)
GetPublicKey() []byte
GetPeerScore(peerId []byte) int64
SetPeerScore(peerId []byte, score int64)
AddPeerScore(peerId []byte, scoreDelta int64)
Reconnect(peerId []byte) error
Bootstrap(ctx context.Context) error
DiscoverPeers(ctx context.Context) error
GetNetwork() uint
IsPeerConnected(peerId []byte) bool
Reachability() *wrapperspb.BoolValue
}