Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

feat!: add peer tagging #255

Merged
merged 1 commit into from
Jun 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/interface-peer-store/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,16 @@ export interface PeerStoreInit {
addressFilter?: AddressFilter
}

export interface TagOptions {
value?: number
ttl?: number
}

export interface Tag {
name: string
value: number
}

export interface PeerStore extends EventEmitter<PeerStoreEvents> {
addressBook: AddressBook
keyBook: KeyBook
Expand All @@ -241,4 +251,8 @@ export interface PeerStore extends EventEmitter<PeerStoreEvents> {
delete: (peerId: PeerId) => Promise<void>
has: (peerId: PeerId) => Promise<boolean>
get: (peerId: PeerId) => Promise<Peer>

tagPeer: (peerId: PeerId, tag: string, options?: TagOptions) => Promise<void>
unTagPeer: (peerId: PeerId, tag: string) => Promise<void>
getTags: (peerId: PeerId) => Promise<Tag[]>
}