Class StreamBaseClient.TupleBuffer

java.lang.Object
com.streambase.sb.client.StreamBaseClient.TupleBuffer
Direct Known Subclasses:
StreamBaseClient.SerializedTupleBuffer
Enclosing class:
StreamBaseClient

public abstract class StreamBaseClient.TupleBuffer extends Object
Class for abstracting away where tuples come from, Buffers, Collections, and Single Enqueues.
  • Field Details

    • bufferTupleCount

      int bufferTupleCount
      Number of tuples in buffer
  • Constructor Details

    • TupleBuffer

      TupleBuffer(StreamProperties props)
      Constructor
      Parameters:
      props - Properties
  • Method Details

    • addTuple

      boolean addTuple(Tuple tuple) throws StreamBaseException
      Add a tuple
      Parameters:
      tuple - Tuple to add
      Returns:
      true if more tuples can be added
      Throws:
      StreamBaseException - Error adding tuple
    • addTuples

      boolean addTuples(Collection<Tuple> tuples) throws StreamBaseException
      Add tuples
      Parameters:
      tuples - Tuples to add
      Returns:
      true if more tuples can be added
      Throws:
      StreamBaseException - Error adding tuples
    • addToBuffer

      protected abstract void addToBuffer(Tuple tuple, int id) throws TupleException
      Add to buffer
      Parameters:
      tuple - Tuple to add
      id - Identifier
      Throws:
      TupleException - Error adding to buffer
    • numBytes

      abstract long numBytes()
      Number of bytes in buffer
      Returns:
      Number of bytes
    • recycle

      void recycle()
      Clear the TupleBuffer
    • enqueue

      abstract void enqueue(boolean hasMore) throws StreamBaseException
      actually enqueue the buffer
      Parameters:
      hasMore - are there more Tuples in this batch of tuples
      Throws:
      StreamBaseException - enqueue error
    • props

      public StreamProperties props()
      get stream properties for this Buffer
      Returns:
      stream properties for the buffer
    • checkTuple

      protected void checkTuple(Tuple tuple)
      Check tuple to make sure it is up to snuff
      Parameters:
      tuple - tuple to check
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • tupleCount

      public int tupleCount()
      Get tuple count
      Returns:
      Number of tuples
    • canEnqueue

      public boolean canEnqueue(StreamProperties props)
      Can enqueue?
      Parameters:
      props - Properties
      Returns:
      true if can enqueue, false otherwise
    • canDequeue

      public boolean canDequeue(StreamProperties props)
      Can dequeue?
      Parameters:
      props - Properties
      Returns:
      true if can dequeue, false otherwise