Enum ObjectWatchOption

  • All Implemented Interfaces:
    java.io.Serializable , kotlin.Comparable

    
    public enum ObjectWatchOption
    extends Enum<ObjectWatchOption>
                        

    How an Object Store watch starts, and what it leaves out

    An option changes where the watch begins or which entries reach the collector. The un-optioned watch starts at the latest revision of every object and then follows changes (io/nats/client/impl/NatsObjectStoreWatchSubscription.java:37).

    INCLUDE_HISTORY and UPDATES_ONLY are two answers to one question - where to start - and cannot both be given. IGNORE_DELETE is independent of the starting point.

    There are three, where a Key-Value watch has four: jnats hard-codes headersOnly to false for an object-store watch (io/nats/client/impl/NatsObjectStoreWatchSubscription.java:35, :53), so there is no counterpart to KvWatchOption.META_ONLY. Nor is there a fromRevision: the same call passes ULONG_UNSET unconditionally (:54), and ObjectStore.watch offers no overload that takes one (io/nats/client/ObjectStore.java:176).

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      IGNORE_DELETE

      Drop the markers left by deleted objects, leaving only live ones

      The filter is applied by the client, not the server (io/nats/client/impl/NatsObjectStoreWatchSubscription.java:64), so an object whose latest revision is a deletion is simply absent: a cache warmed this way cannot tell "never existed" from "deleted". ObjectStoreInfo.deleted is how the un-optioned watch reports the same thing without losing the entry.

      INCLUDE_HISTORY

      Start at the first retained metadata revision of every object rather than the latest

      DeliverPolicy.All (io/nats/client/impl/NatsObjectStoreWatchSubscription.java:44), which replays every metadata message the bucket still holds rather than the last one per object.

      In a bucket written through jnats this changes nothing, and the option is here because jnats offers it rather than because it can do what its Key-Value namesake does. Every metadata write carries Nats-Rollup: sub (io/nats/client/support/NatsObjectStoreUtil.java:63-66, io/nats/client/support/NatsJetStreamConstants.java:114-115) against a stream built with allowRollup(true) (io/nats/client/api/ObjectStoreConfiguration.java:215), so the server purges an object's earlier metadata as each new revision lands: at most one survives per object, and All and LastPerSubject see the same set. An object store keeps no history to replay, so where KvWatchOption.INCLUDE_HISTORY widens the snapshot this only reorders it - by stream sequence rather than by subject.

      UPDATES_ONLY

      Skip the snapshot entirely and start at the next change

      DeliverPolicy.New (io/nats/client/impl/NatsObjectStoreWatchSubscription.java:43). The initial sync is complete immediately, before any entry - and, uniquely to this option, before the watch has been established at all (io/nats/client/impl/NatsWatchSubscription.java:50-52), so ObjectWatchEvent.InitialSyncComplete is not a rendezvous a writer can wait on here.

    • Method Summary

      Modifier and Type Method Description
      final Array<ObjectWatchOption> values() Returns an array containing the constants of this enum type, in the order they're declared.
      final ObjectWatchOption valueOf(String value) Returns the enum constant of this type with the specified name.
      final EnumEntries<ObjectWatchOption> getEntries()
      • Methods inherited from class kotlin.Enum

        getName, getOrdinal
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • values

         final Array<ObjectWatchOption> values()

        Returns an array containing the constants of this enum type, in the order they're declared.

        This method may be used to iterate over the constants.

      • valueOf

         final ObjectWatchOption valueOf(String value)

        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)