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

fix: update query event naming #410

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
26 changes: 13 additions & 13 deletions packages/interface-dht/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import type { CID } from 'multiformats/cid'
* The types of events emitted during DHT queries
*/
export enum EventTypes {
SENDING_QUERY = 0,
SEND_QUERY = 0,
PEER_RESPONSE,
FINAL_PEER,
QUERY_ERROR,
PROVIDER,
VALUE,
ADDING_PEER,
DIALING_PEER
ADD_PEER,
DIAL_PEER
}

/**
Expand Down Expand Up @@ -45,10 +45,10 @@ export interface QueryOptions extends AbortOptions {
/**
* Emitted when sending queries to remote peers
*/
export interface SendingQueryEvent {
export interface SendQueryEvent {
to: PeerId
type: EventTypes.SENDING_QUERY
name: 'SENDING_QUERY'
type: EventTypes.SEND_QUERY
name: 'SEND_QUERY'
messageName: keyof typeof MessageType
messageType: MessageType
}
Expand Down Expand Up @@ -111,22 +111,22 @@ export interface ValueEvent {
/**
* Emitted when peers are added to a query
*/
export interface AddingPeerEvent {
type: EventTypes.ADDING_PEER
name: 'ADDING_PEER'
export interface AddPeerEvent {
type: EventTypes.ADD_PEER
name: 'ADD_PEER'
peer: PeerId
}

/**
* Emitted when peers are dialled as part of a query
*/
export interface DialingPeerEvent {
export interface DialPeerEvent {
peer: PeerId
type: EventTypes.DIALING_PEER
name: 'DIALING_PEER'
type: EventTypes.DIAL_PEER
name: 'DIAL_PEER'
}

export type QueryEvent = SendingQueryEvent | PeerResponseEvent | FinalPeerEvent | QueryErrorEvent | ProviderEvent | ValueEvent | AddingPeerEvent | DialingPeerEvent
export type QueryEvent = SendQueryEvent | PeerResponseEvent | FinalPeerEvent | QueryErrorEvent | ProviderEvent | ValueEvent | AddPeerEvent | DialPeerEvent

export interface RoutingTable {
size: number
Expand Down