Class EntryHolderAggregatorContext

java.lang.Object
com.gigaspaces.query.aggregators.SpaceEntriesAggregatorContext
com.gigaspaces.internal.query.EntryHolderAggregatorContext

public class EntryHolderAggregatorContext extends SpaceEntriesAggregatorContext
Since:
10.0
Author:
Niv Ingberg
  • Constructor Details

  • Method Details

    • withExecutionDeadline

      public static EntryHolderAggregatorContext withExecutionDeadline(SpaceEntriesAggregatorContext context)
      The context of an aggregation that has an execution timeout, or null. For an aggregator that walks an index itself instead of being handed entries by the scan: it then has to call checkExecutionDeadline() as it goes, as the scan would between entries (PIC-6362).
    • checkExecutionDeadline

      public void checkExecutionDeadline()
      Throws once the aggregation has run past its execution timeout; see withExecutionDeadline(SpaceEntriesAggregatorContext).
    • scan

      public void scan(Context context, IEntryData entryData, String uid, boolean isTransient)
    • scanInPlace

      public void scanInPlace(ServerEntry values, String uid)
      Aggregates one entry from values read out of the block it occupies, instead of from an entry built for the purpose. Only legitimate after fixedPropertiesToRead(IServerTypeDesc) has answered for this entry's type and needsWholeEntry() has answered no, or has answered yes and been handed a packet through the overload below - which is also what makes the type resolve(IServerTypeDesc) last saw this entry's own, as getTypeDescriptor() relies on.
      Parameters:
      values - the values read under the entry's state lock, holding at least the positions fixedPropertiesToRead(IServerTypeDesc) asked for
      uid - the entry's uid, which lives in its cache info rather than in its block
    • scanInPlace

      public void scanInPlace(ServerEntry values, IEntryPacket packet, String uid)
      As scanInPlace(ServerEntry, String), for an entry needsWholeEntry() answered yes to and takesAProjectedPacket() let through: what the aggregator reaches for through getRawEntry() is then the packet built out of the block.
      Parameters:
      packet - the entry's packet, narrowed to the template's projection, or null
    • fixedPropertiesToRead

      public int[] fixedPropertiesToRead(IServerTypeDesc typeDesc)
      The fixed properties of an entry of this type that the aggregators need read out of its block, or null when this set of aggregators cannot be served without the entry itself.

      Resolving has to happen before the scan reaches the block, because the values are read eagerly under the entry's state lock and what to read has to be known by then. It is kept per type rather than per scan: one scan covers a type and its subtypes, and a property's position is the type descriptor's, not the engine's.

    • needsWholeEntry

      public boolean needsWholeEntry()
      Whether some aggregator wants this entry itself, asked once per entry. Only an aggregator that can change its mind mid-scan is asked at all - see MayNeedWholeEntry for why that is not something the public aggregator API offers - so for every other set this is a walk over the list and nothing more.
    • takesAProjectedPacket

      public boolean takesAProjectedPacket()
      Whether a yes from needsWholeEntry() may be answered with a packet narrowed to the template's projection instead of the entry. Only when the aggregator asking is the whole set: any other aggregator beside it would be handed the same packet by getRawEntry(), holes and all, where on the materialising path it would get the entry.
    • getPartitionId

      public int getPartitionId()
      Specified by:
      getPartitionId in class SpaceEntriesAggregatorContext
    • getEntryUid

      public String getEntryUid()
      Specified by:
      getEntryUid in class SpaceEntriesAggregatorContext
    • getRawEntry

      public RawEntry getRawEntry()
      Specified by:
      getRawEntry in class SpaceEntriesAggregatorContext
      Returns:
      the raw entry match by this context
      See Also:
    • maskPii

      public void maskPii(IEntryPacket packet)
      Field level security: omits the PII properties the user lacks read privilege for from an entry built by an aggregator directly (e.g. from an index scan) instead of via getRawEntry().
    • applyProjectionTemplate

      public void applyProjectionTemplate(RawEntry entry)
      Specified by:
      applyProjectionTemplate in class SpaceEntriesAggregatorContext
    • getServerEntry

      public ServerEntry getServerEntry()
      The entry itself, which in the in-place state does not exist: only the declared paths were read, and the view holding them is indexed by position, so a property asked for by name would come back as null rather than as what the entry holds. Refused for the same reason getRawEntry() is, and refused whatever the user may read - nothing leaves the block this way at all, which is why there is no masking here.
      Specified by:
      getServerEntry in class SpaceEntriesAggregatorContext
    • getTypeDescriptor

      public SpaceTypeDescriptor getTypeDescriptor()
      The type being scanned, which a declaring aggregator may ask for and SpaceIteratorAggregator does ask for on this very route - so it cannot be left to the base implementation, which reads it off getServerEntry(). Answered from the descriptor resolve(IServerTypeDesc) last saw, which is this entry's own: the scan covers a type together with its subtypes, and the paths were resolved against the same descriptor the values were then read by.
      Overrides:
      getTypeDescriptor in class SpaceEntriesAggregatorContext
    • getPathValueImpl

      protected Object getPathValueImpl(String path)
      The value behind one declared path. In the in-place state the paths were resolved to positions before the block was read, so this is a lookup rather than the type descriptor walk the entry data would do - and a path nobody declared cannot be answered at all, which is a bug in the declaration rather than a value that happens to be missing.

      Field level security is enforced on both states, in different places for the same reason the values are read in different places: the materialising state asks per path, as it always has, because the set of paths that will be asked for is not known in advance; the in-place state asked for all of them at once in resolve(IServerTypeDesc), because knowing them in advance is what let the block be read at all.

      Overrides:
      getPathValueImpl in class SpaceEntriesAggregatorContext