import {Ice} from 'ice'; import '../Ice/Identity'; import '../Ice/SliceChecksumDict'; import {IceMX} from '../IceStorm/Metrics'; declare module './IceStorm.ns' { /** * A messaging service with support for federation. In contrast to * most other messaging or event services, IceStorm supports typed * events, meaning that broadcasting a message over a federation is as * easy as invoking a method on an interface. */ namespace IceStorm { /** * Information on the topic links. */ class LinkInfo implements Ice.Struct { constructor(theTopic?: TopicPrx | null, name?: string, cost?: number); /** * The linked topic. */ theTopic: TopicPrx | null; /** * The name of the linked topic. */ name: string; /** * The cost of traversing this link. */ cost: number; clone(): this; equals(other: this): boolean; hashCode(): number; } /** * A sequence of {@link LinkInfo} objects. */ type LinkInfoSeq = Array; type QoS = Map; const QoS: { new (entries?: ReadonlyArray<[string, string]>): QoS; }; /** * This exception indicates that an attempt was made to create a link * that already exists. */ class LinkExists extends Ice.UserException { constructor(name?: string); name: string; } /** * This exception indicates that an attempt was made to remove a * link that does not exist. */ class NoSuchLink extends Ice.UserException { constructor(name?: string); name: string; } /** * This exception indicates that an attempt was made to subscribe * a proxy for which a subscription already exists. */ class AlreadySubscribed extends Ice.UserException {} /** * This exception indicates that an attempt was made to subscribe * a proxy that is null. */ class InvalidSubscriber extends Ice.UserException { constructor(reason?: string); /** * The reason for the failure. */ reason: string; } /** * This exception indicates that a subscription failed due to an * invalid QoS. */ class BadQoS extends Ice.UserException { constructor(reason?: string); /** * The reason for the failure. */ reason: string; } /** * Publishers publish information on a particular topic. A topic * logically represents a type. * * @see TopicManager */ abstract class Topic extends Ice.Object { /** * Get the name of this topic. * * @return The name of the topic. * * @see TopicManager#create */ abstract getName(current: Ice.Current): Ice.OperationResult; /** * Get a proxy to a publisher object for this topic. To publish * data to a topic, the publisher calls {@link Topic#getPublisher} and then * casts to the topic type. An unchecked cast must be used on this * proxy. If a replicated IceStorm deployment is used this call * may return a replicated proxy. * * @return A proxy to publish data on this topic. */ abstract getPublisher( current: Ice.Current, ): Ice.OperationResult; /** * Get a non-replicated proxy to a publisher object for this * topic. To publish data to a topic, the publisher calls * {@link Topic#getPublisher} and then casts to the topic type. An unchecked * cast must be used on this proxy. * * @return A proxy to publish data on this topic. */ abstract getNonReplicatedPublisher( current: Ice.Current, ): Ice.OperationResult; /** * Subscribe with the given qos to this topic. A * per-subscriber publisher object is returned. * * @param theQoS The quality of service parameters for this * subscription. * * @param subscriber The subscriber's proxy. * * @return The per-subscriber publisher object. * * @throws AlreadySubscribed Raised if the subscriber object is * already subscribed. * * @throws InvalidSubscriber Raised if the subscriber object is null. * * @throws BadQoS Raised if the requested quality of service * is unavailable or invalid. * * @see #unsubscribe */ abstract subscribeAndGetPublisher( theQoS: QoS, subscriber: Ice.ObjectPrx | null, current: Ice.Current, ): Ice.OperationResult; /** * Unsubscribe the given subscriber. * * @param subscriber The proxy of an existing subscriber. * * @see #subscribeAndGetPublisher */ abstract unsubscribe( subscriber: Ice.ObjectPrx | null, current: Ice.Current, ): Ice.OperationResult; /** * Create a link to the given topic. All events originating * on this topic will also be sent to linkTo. * * @param linkTo The topic to link to. * * @param cost The cost to the linked topic. * * @throws LinkExists Raised if a link to the same topic already * exists. */ abstract link( linkTo: TopicPrx | null, cost: number, current: Ice.Current, ): Ice.OperationResult; /** * Destroy the link from this topic to the given topic linkTo. * * @param linkTo The topic to destroy the link to. * * @throws NoSuchLink Raised if a link to the topic does not exist. */ abstract unlink( linkTo: TopicPrx | null, current: Ice.Current, ): Ice.OperationResult; /** * Retrieve information on the current links. * * @return A sequence of LinkInfo objects. */ abstract getLinkInfoSeq( current: Ice.Current, ): Ice.OperationResult; /** * Retrieve the list of subscribers for this topic. * * @return The sequence of Ice identities for the subscriber objects. */ abstract getSubscribers( current: Ice.Current, ): Ice.OperationResult; /** * Destroy the topic. */ abstract destroy(current: Ice.Current): Ice.OperationResult; } /** * Publishers publish information on a particular topic. A topic * logically represents a type. * * @see TopicManager */ class TopicPrx extends Ice.ObjectPrx { /** * Get the name of this topic. * * @return The name of the topic. * * @see TopicManager#create */ getName(ctx?: Ice.Context): Ice.AsyncResult; /** * Get a proxy to a publisher object for this topic. To publish * data to a topic, the publisher calls {@link Topic#getPublisher} and then * casts to the topic type. An unchecked cast must be used on this * proxy. If a replicated IceStorm deployment is used this call * may return a replicated proxy. * * @return A proxy to publish data on this topic. */ getPublisher(ctx?: Ice.Context): Ice.AsyncResult; /** * Get a non-replicated proxy to a publisher object for this * topic. To publish data to a topic, the publisher calls * {@link Topic#getPublisher} and then casts to the topic type. An unchecked * cast must be used on this proxy. * * @return A proxy to publish data on this topic. */ getNonReplicatedPublisher( ctx?: Ice.Context, ): Ice.AsyncResult; /** * Subscribe with the given qos to this topic. A * per-subscriber publisher object is returned. * * @param theQoS The quality of service parameters for this * subscription. * * @param subscriber The subscriber's proxy. * * @return The per-subscriber publisher object. * * @throws AlreadySubscribed Raised if the subscriber object is * already subscribed. * * @throws InvalidSubscriber Raised if the subscriber object is null. * * @throws BadQoS Raised if the requested quality of service * is unavailable or invalid. * * @see #unsubscribe */ subscribeAndGetPublisher( theQoS: QoS, subscriber: Ice.ObjectPrx | null, ctx?: Ice.Context, ): Ice.AsyncResult; /** * Unsubscribe the given subscriber. * * @param subscriber The proxy of an existing subscriber. * * @see #subscribeAndGetPublisher */ unsubscribe( subscriber: Ice.ObjectPrx | null, ctx?: Ice.Context, ): Ice.AsyncResult; /** * Create a link to the given topic. All events originating * on this topic will also be sent to linkTo. * * @param linkTo The topic to link to. * * @param cost The cost to the linked topic. * * @throws LinkExists Raised if a link to the same topic already * exists. */ link( linkTo: TopicPrx | null, cost: number, ctx?: Ice.Context, ): Ice.AsyncResult; /** * Destroy the link from this topic to the given topic linkTo. * * @param linkTo The topic to destroy the link to. * * @throws NoSuchLink Raised if a link to the topic does not exist. */ unlink(linkTo: TopicPrx | null, ctx?: Ice.Context): Ice.AsyncResult; /** * Retrieve information on the current links. * * @return A sequence of LinkInfo objects. */ getLinkInfoSeq(ctx?: Ice.Context): Ice.AsyncResult; /** * Retrieve the list of subscribers for this topic. * * @return The sequence of Ice identities for the subscriber objects. */ getSubscribers(ctx?: Ice.Context): Ice.AsyncResult; /** * Destroy the topic. */ destroy(ctx?: Ice.Context): Ice.AsyncResult; } /** * Mapping of topic name to topic proxy. */ type TopicDict = Map; const TopicDict: { /** * Mapping of topic name to topic proxy. */ new (entries?: ReadonlyArray<[string, TopicPrx | null]>): TopicDict; }; /** * This exception indicates that an attempt was made to create a topic * that already exists. */ class TopicExists extends Ice.UserException { constructor(name?: string); name: string; } /** * This exception indicates that an attempt was made to retrieve a * topic that does not exist. */ class NoSuchTopic extends Ice.UserException { constructor(name?: string); name: string; } /** * A topic manager manages topics, and subscribers to topics. * * @see Topic */ abstract class TopicManager extends Ice.Object { /** * Create a new topic. The topic name must be unique, otherwise * {@link TopicExists} is raised. * * @param name The name of the topic. * * @return A proxy to the topic instance. * * @throws TopicExists Raised if a topic with the same name already * exists. */ abstract create( name: string, current: Ice.Current, ): Ice.OperationResult; /** * Retrieve a topic by name. * * @param name The name of the topic. * * @return A proxy to the topic instance. * * @throws NoSuchTopic Raised if the topic does not exist. */ abstract retrieve( name: string, current: Ice.Current, ): Ice.OperationResult; /** * Retrieve all topics managed by this topic manager. * * @return A dictionary of string, topic proxy pairs. */ abstract retrieveAll( current: Ice.Current, ): Ice.OperationResult; /** * Returns the checksums for the IceStorm Slice definitions. * * @return A dictionary mapping Slice type ids to their checksums. */ abstract getSliceChecksums( current: Ice.Current, ): Ice.OperationResult; } /** * A topic manager manages topics, and subscribers to topics. * * @see Topic */ class TopicManagerPrx extends Ice.ObjectPrx { /** * Create a new topic. The topic name must be unique, otherwise * {@link TopicExists} is raised. * * @param name The name of the topic. * * @return A proxy to the topic instance. * * @throws TopicExists Raised if a topic with the same name already * exists. */ create(name: string, ctx?: Ice.Context): Ice.AsyncResult; /** * Retrieve a topic by name. * * @param name The name of the topic. * * @return A proxy to the topic instance. * * @throws NoSuchTopic Raised if the topic does not exist. */ retrieve( name: string, ctx?: Ice.Context, ): Ice.AsyncResult; /** * Retrieve all topics managed by this topic manager. * * @return A dictionary of string, topic proxy pairs. */ retrieveAll(ctx?: Ice.Context): Ice.AsyncResult; /** * Returns the checksums for the IceStorm Slice definitions. * * @return A dictionary mapping Slice type ids to their checksums. */ getSliceChecksums( ctx?: Ice.Context, ): Ice.AsyncResult; } /** * This inferface is advertised by the IceStorm service through the * Ice object with the identity `IceStorm/Finder'. This allows clients * to retrieve the topic manager with just the endpoint information of * the IceStorm service. */ abstract class Finder extends Ice.Object { /** * Get the topic manager proxy. The proxy might point to several * replicas. * * @return The topic manager proxy. */ abstract getTopicManager( current: Ice.Current, ): Ice.OperationResult; } /** * This inferface is advertised by the IceStorm service through the * Ice object with the identity `IceStorm/Finder'. This allows clients * to retrieve the topic manager with just the endpoint information of * the IceStorm service. */ class FinderPrx extends Ice.ObjectPrx { /** * Get the topic manager proxy. The proxy might point to several * replicas. * * @return The topic manager proxy. */ getTopicManager( ctx?: Ice.Context, ): Ice.AsyncResult; } } } export {IceStorm} from './IceStorm.ns';