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
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
FieldsModifier and TypeFieldDescriptionprotected final LongFunction<Object> protected static final org.apache.logging.log4j.Loggerprotected final REQUESTprotected final com.google.cloud.spanner.Spanner -
Constructor Summary
ConstructorsConstructorDescriptionGCPSpannerBaseOp(com.google.cloud.spanner.Spanner spannerClient, REQUEST requestParam) Constructs a new GCPSpannerBaseOp with the specified Spanner client and request parameter. -
Method Summary
Modifier and TypeMethodDescriptionfinal RESULTapply(long value) Applies the operation for the given cycle value.abstract RESULTapplyOp(long value) Abstract method to be implemented by subclasses to define the specific operation logic.toString()Returns a string representation of the GCPSpannerBaseOp.
-
Field Details
-
logger
protected static final org.apache.logging.log4j.Logger logger -
spannerClient
protected final com.google.cloud.spanner.Spanner spannerClient -
request
-
apiCall
-
-
Constructor Details
-
GCPSpannerBaseOp
Constructs a new GCPSpannerBaseOp with the specified Spanner client and request parameter.- Parameters:
spannerClient- the Spanner client to use for operationsrequestParam- the request parameter for the operation
-
-
Method Details
-
apply
Applies the operation for the given cycle value. This method logs the operation and handles any exceptions by throwing a RuntimeException. -
applyOp
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
-