MCPcopy
hub / github.com/Effect-TS/effect / pubsubFromOptions

Function pubsubFromOptions

packages/effect/src/internal/stream.ts:7008–7031  ·  view source on GitHub ↗
(
  options: number | {
    readonly capacity: "unbounded"
    readonly replay?: number | undefined
  } | {
    readonly capacity: number
    readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
    readonly replay?: number | undefined
  }
)

Source from the content-addressed store, hash-verified

7006)
7007
7008const pubsubFromOptions = <A, E>(
7009 options: number | {
7010 readonly capacity: "unbounded"
7011 readonly replay?: number | undefined
7012 } | {
7013 readonly capacity: number
7014 readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
7015 readonly replay?: number | undefined
7016 }
7017): Effect.Effect<PubSub.PubSub<Take.Take<A, E>>> => {
7018 if (typeof options === "number") {
7019 return PubSub.bounded(options)
7020 } else if (options.capacity === "unbounded") {
7021 return PubSub.unbounded({ replay: options.replay })
7022 }
7023 switch (options.strategy) {
7024 case "dropping":
7025 return PubSub.dropping(options)
7026 case "sliding":
7027 return PubSub.sliding(options)
7028 default:
7029 return PubSub.bounded(options)
7030 }
7031}
7032
7033/** @internal */
7034export const toPubSub = dual<

Callers 1

stream.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…