Class GCPSpannerBaseOp<REQUEST,RESULT>

java.lang.Object
io.nosqlbench.adapter.gcpspanner.ops.GCPSpannerBaseOp<REQUEST,RESULT>
Type Parameters:
RESULT - the type of the request parameter
All Implemented Interfaces:
CycleOp<RESULT>, LongFunction<RESULT>
Direct Known Subclasses:
GCPSpannerCreateDatabaseDdlOp, GCPSpannerDropDatabaseDdlOp, GCPSpannerExecuteDmlOp, GCPSpannerInsertOp, GCPSpannerUpdateDatabaseDdlOp

public abstract class GCPSpannerBaseOp<REQUEST,RESULT> extends Object implements CycleOp<RESULT>
Abstract base class for GCP Spanner operations. This class implements the CycleOp interface and provides a template for executing operations with a Spanner client.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final LongFunction<Object>
     
    protected static final org.apache.logging.log4j.Logger
     
    protected final REQUEST
     
    protected final com.google.cloud.spanner.Spanner
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    GCPSpannerBaseOp(com.google.cloud.spanner.Spanner spannerClient, REQUEST requestParam)
    Constructs a new GCPSpannerBaseOp with the specified Spanner client and request parameter.
  • Method Summary

    Modifier and Type
    Method
    Description
    final RESULT
    apply(long value)
    Applies the operation for the given cycle value.
    abstract RESULT
    applyOp(long value)
    Abstract method to be implemented by subclasses to define the specific operation logic.
    Returns a string representation of the GCPSpannerBaseOp.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • logger

      protected static final org.apache.logging.log4j.Logger logger
    • spannerClient

      protected final com.google.cloud.spanner.Spanner spannerClient
    • request

      protected final REQUEST request
    • apiCall

      protected final LongFunction<Object> apiCall
  • Constructor Details

    • GCPSpannerBaseOp

      public GCPSpannerBaseOp(com.google.cloud.spanner.Spanner spannerClient, REQUEST requestParam)
      Constructs a new GCPSpannerBaseOp with the specified Spanner client and request parameter.
      Parameters:
      spannerClient - the Spanner client to use for operations
      requestParam - the request parameter for the operation
  • Method Details

    • apply

      public final RESULT apply(long value)
      Applies the operation for the given cycle value. This method logs the operation and handles any exceptions by throwing a RuntimeException.
      Specified by:
      apply in interface CycleOp<REQUEST>
      Specified by:
      apply in interface LongFunction<REQUEST>
      Parameters:
      value - the cycle value
      Returns:
      the result of the operation
    • applyOp

      public abstract RESULT applyOp(long value)
      Abstract method to be implemented by subclasses to define the specific operation logic.
      Parameters:
      value - the cycle value
      Returns:
      the result of the operation
    • toString

      public String toString()
      Returns a string representation of the GCPSpannerBaseOp.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the GCPSpannerBaseOp