Strategy

trait Strategy[I, O, S, Selector] extends Strategy[I, O, S, Selector]
Companion
object
trait Strategy[I, O, S, Selector]
class Object
trait Matchable
class Any

Value members

Inherited methods

def accepts(i: I, state: S): Boolean

Verifies if I can be accepted.

Verifies if I can be accepted.

If this yields to true, then the pubsub can accept this element, and interpreter is free to invoke publish. If this yields to false, then interpreter holds the publisher, until there is at least one get (either successsful or not) in which case this is consulted again.

Value Params
i

I to publish

Inherited from
Strategy
def empty(state: S): Boolean

Yields to true if there are no elements to get.

Yields to true if there are no elements to get.

Inherited from
Strategy
def get(selector: Selector, state: S): (S, Option[O])

Gets O, selected by selector.

Gets O, selected by selector.

Yields to None, if subscriber cannot be satisfied, causing the subscriber to hold, until next successful publish Yields to Some((s,o)) if the subscriber may be satisfied.

Value Params
selector

specifies which O this get is interested in. In case of a subscription based strategy, the Selector shall hold the identity of the subscriber.

Inherited from
Strategy
def initial: S

Initial state of this strategy. *

Initial state of this strategy. *

Inherited from
Strategy
def publish(i: I, state: S): S

Publishes I. This must always succeed.

Publishes I. This must always succeed.

Interpreter must only invoke this when accepts yields to true.

Value Params
i

I to publish

Inherited from
Strategy
def subscribe(selector: Selector, state: S): (S, Boolean)

Consulted by interpreter to subscribe the given selector. A subscriptions manages context/state across multiple get requests. Yields to false if the subscription cannot be satisfied.

Consulted by interpreter to subscribe the given selector. A subscriptions manages context/state across multiple get requests. Yields to false if the subscription cannot be satisfied.

Value Params
selector

selector that shall be used with mulitple subsequent get operations

Inherited from
Strategy
def transformSelector[Sel2](f: (Sel2, S) => Selector): Strategy[I, O, S, Sel2]

Transforms selector to selector of this state by applying the f to Sel2 and state of this strategy. *

Transforms selector to selector of this state by applying the f to Sel2 and state of this strategy. *

Inherited from
Strategy
def unsubscribe(selector: Selector, state: S): S

When strategy supports long-term subscriptions, this is used by interpreter to cancel a previous subscription, indicating the subscriber is no longer interested in getting more data.

When strategy supports long-term subscriptions, this is used by interpreter to cancel a previous subscription, indicating the subscriber is no longer interested in getting more data.

Value Params
selector

selector whose selection shall be canceled

Inherited from
Strategy