Skip to content

Commit

Permalink
fix: update query event naming (libp2p#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
maschad committed Jun 3, 2023
1 parent 9e86d57 commit 5aebae1
Showing 1 changed file with 13 additions and 13 deletions.
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

0 comments on commit 5aebae1

Please sign in to comment.