Diff
Not logged in

Differences From Artifact [ddad53664b]:

To Artifact [dc6f3ed590]:


1

2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
..
39
40
41
42
43
44
45

46
47
48
49
50
51
52
53
54
55
56
57
58
import { AccountInfo } from './accounts'


export interface MiddlewareDefinition {
  type: string,
  options?: object
}

/**
 * Services the connector exposes to middleware.
 */
export interface MiddlewareServices {

  getInfo (accountId: string): AccountInfo
  getOwnAddress (): string
  sendData (data: Buffer, accountId: string): Promise<Buffer>
  sendMoney (amount: string, accountId: string): Promise<void>
}

export interface MiddlewareCallback<T,U> {
................................................................................
  insertBefore (middlewareName: string, entry: PipelineEntry<T,U>): void
  insertAfter (middlewareName: string, entry: PipelineEntry<T,U>): void
  getMethods (): MiddlewareMethod<T,U>[]
}

export interface Pipelines {
  readonly startup: Pipeline<void, void>,

  readonly incomingData: Pipeline<Buffer, Buffer>,
  readonly incomingMoney: Pipeline<string, void>,
  readonly outgoingData: Pipeline<Buffer, Buffer>
  readonly outgoingMoney: Pipeline<string, void>
}

export interface Middleware {
  applyToPipelines: (pipelines: Pipelines, accountId: string) => Promise<void>
}

export interface MiddlewareConstructor {
  new (options: object, api: MiddlewareServices): Middleware
}

>










>







 







>













1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { AccountInfo } from './accounts'
import Stats from '../services/stats'

export interface MiddlewareDefinition {
  type: string,
  options?: object
}

/**
 * Services the connector exposes to middleware.
 */
export interface MiddlewareServices {
  stats: Stats
  getInfo (accountId: string): AccountInfo
  getOwnAddress (): string
  sendData (data: Buffer, accountId: string): Promise<Buffer>
  sendMoney (amount: string, accountId: string): Promise<void>
}

export interface MiddlewareCallback<T,U> {
................................................................................
  insertBefore (middlewareName: string, entry: PipelineEntry<T,U>): void
  insertAfter (middlewareName: string, entry: PipelineEntry<T,U>): void
  getMethods (): MiddlewareMethod<T,U>[]
}

export interface Pipelines {
  readonly startup: Pipeline<void, void>,
  readonly teardown: Pipeline<void, void>,
  readonly incomingData: Pipeline<Buffer, Buffer>,
  readonly incomingMoney: Pipeline<string, void>,
  readonly outgoingData: Pipeline<Buffer, Buffer>
  readonly outgoingMoney: Pipeline<string, void>
}

export interface Middleware {
  applyToPipelines: (pipelines: Pipelines, accountId: string) => Promise<void>
}

export interface MiddlewareConstructor {
  new (options: object, api: MiddlewareServices): Middleware
}