K
- the type of the keyV
- the type of the valueU
- the type of the updatepublic class RemoteTableDescriptor<K,V,U> extends BaseTableDescriptor<K,V,RemoteTableDescriptor<K,V,U>>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ASYNC_CALLBACK_POOL_SIZE |
static java.lang.String |
BATCH_PROVIDER |
static java.lang.String |
DEFAULT_RATE_LIMITER_CLASS_NAME |
static java.lang.String |
PROVIDER_FACTORY_CLASS_NAME |
static java.lang.String |
RATE_LIMITER |
static java.lang.String |
READ_CREDIT_FN |
static java.lang.String |
READ_CREDITS |
static java.lang.String |
READ_FN |
static java.lang.String |
READ_RETRY_POLICY |
static java.lang.String |
RL_READ_TAG
Tag to be used for provision credits for rate limiting read operations from the remote table.
|
static java.lang.String |
RL_WRITE_TAG
Tag to be used for provision credits for rate limiting write operations into the remote table.
|
static java.lang.String |
WRITE_CREDIT_FN |
static java.lang.String |
WRITE_CREDITS |
static java.lang.String |
WRITE_FN |
static java.lang.String |
WRITE_RETRY_POLICY |
config, tableId
Constructor and Description |
---|
RemoteTableDescriptor(java.lang.String tableId)
Constructs a table descriptor instance
|
Modifier and Type | Method and Description |
---|---|
protected void |
addTablePartConfig(java.lang.String tablePartKey,
TablePart tablePart,
Config jobConfig,
java.util.Map<java.lang.String,java.lang.String> tableConfig)
Helper method to add table part config items to table configuration
|
java.lang.String |
getProviderFactoryClassName()
Return the fully qualified class name of the
TableProviderFactory |
java.util.Map<java.lang.String,java.lang.String> |
toConfig(Config jobConfig)
Generate configuration for this table descriptor, the generated configuration
should be the complete configuration for this table that can be directly
included in the job configuration.
|
protected void |
validate()
Validate that this table descriptor is constructed properly; this method is used internally.
|
RemoteTableDescriptor<K,V,U> |
withAsyncCallbackExecutorPoolSize(int poolSize)
Specify the size of the thread pool for the executor used to execute
callbacks of CompletableFutures of async Table operations.
|
RemoteTableDescriptor<K,V,U> |
withBatchProvider(BatchProvider<K,V,U> batchProvider)
Specifies a batch provider inorder to batch Table operations.
|
RemoteTableDescriptor<K,V,U> |
withRateLimiter(RateLimiter rateLimiter,
TableRateLimiter.CreditFunction<K,V> readCreditFn,
TableRateLimiter.CreditFunction<K,V> writeCreditFn)
Specify a rate limiter along with credit functions to map a table record (as KV) to the amount
of credits to be charged from the rate limiter for table read and write operations.
|
RemoteTableDescriptor<K,V,U> |
withRateLimiterDisabled()
Disable both read and write rate limiter.
|
RemoteTableDescriptor<K,V,U> |
withReadFunction(TableReadFunction<K,V> readFn)
Use specified TableReadFunction with remote table and a retry policy.
|
RemoteTableDescriptor<K,V,U> |
withReadRateLimit(int creditsPerSec)
Specify the rate limit for table read operations.
|
RemoteTableDescriptor<K,V,U> |
withReadRateLimiterDisabled()
Disable the read rate limiter.
|
RemoteTableDescriptor<K,V,U> |
withReadRetryPolicy(TableRetryPolicy retryPolicy)
Use specified
TableRetryPolicy with the TableReadFunction . |
RemoteTableDescriptor<K,V,U> |
withWriteFunction(TableWriteFunction<K,V,U> writeFn)
Use specified TableWriteFunction with remote table and a retry policy.
|
RemoteTableDescriptor<K,V,U> |
withWriteRateLimit(int creditsPerSec)
Specify the rate limit for table write operations.
|
RemoteTableDescriptor<K,V,U> |
withWriteRateLimiterDisabled()
Disable the write rate limiter.
|
RemoteTableDescriptor<K,V,U> |
withWriteRetryPolicy(TableRetryPolicy retryPolicy)
Use specified
TableRetryPolicy with the TableWriteFunction . |
addTableConfig, getTableId, withConfig
public static final java.lang.String PROVIDER_FACTORY_CLASS_NAME
public static final java.lang.String DEFAULT_RATE_LIMITER_CLASS_NAME
public static final java.lang.String RL_READ_TAG
withRateLimiter(RateLimiter, TableRateLimiter.CreditFunction,
TableRateLimiter.CreditFunction)
public static final java.lang.String RL_WRITE_TAG
withRateLimiter(RateLimiter, TableRateLimiter.CreditFunction,
TableRateLimiter.CreditFunction)
and it needs the write functionality.public static final java.lang.String READ_FN
public static final java.lang.String WRITE_FN
public static final java.lang.String RATE_LIMITER
public static final java.lang.String READ_CREDITS
public static final java.lang.String WRITE_CREDITS
public static final java.lang.String READ_CREDIT_FN
public static final java.lang.String WRITE_CREDIT_FN
public static final java.lang.String ASYNC_CALLBACK_POOL_SIZE
public static final java.lang.String READ_RETRY_POLICY
public static final java.lang.String WRITE_RETRY_POLICY
public static final java.lang.String BATCH_PROVIDER
public RemoteTableDescriptor(java.lang.String tableId)
tableId
- Id of the table, it must conform to pattern [\\d\\w-_]+public RemoteTableDescriptor<K,V,U> withReadFunction(TableReadFunction<K,V> readFn)
readFn
- read function instancepublic RemoteTableDescriptor<K,V,U> withWriteFunction(TableWriteFunction<K,V,U> writeFn)
writeFn
- write function instancepublic RemoteTableDescriptor<K,V,U> withReadRetryPolicy(TableRetryPolicy retryPolicy)
TableRetryPolicy
with the TableReadFunction
.retryPolicy
- retry policy for the write functionpublic RemoteTableDescriptor<K,V,U> withWriteRetryPolicy(TableRetryPolicy retryPolicy)
TableRetryPolicy
with the TableWriteFunction
.retryPolicy
- retry policy for the write functionpublic RemoteTableDescriptor<K,V,U> withRateLimiter(RateLimiter rateLimiter, TableRateLimiter.CreditFunction<K,V> readCreditFn, TableRateLimiter.CreditFunction<K,V> writeCreditFn)
withReadRateLimit(int)
and
withWriteRateLimit(int)
.rateLimiter
- rate limiter instance to be used for throttlingreadCreditFn
- credit function for rate limiting read operationswriteCreditFn
- credit function for rate limiting write operationspublic RemoteTableDescriptor<K,V,U> withRateLimiterDisabled()
withRateLimiter(RateLimiter, TableRateLimiter.CreditFunction, TableRateLimiter.CreditFunction)
or withReadRateLimit(int)
. If the write rate limiter is enabled,
the user must provide a rate limiter by calling withRateLimiter(RateLimiter, TableRateLimiter.CreditFunction,
TableRateLimiter.CreditFunction)
or withWriteRateLimit(int)
.
By default, both read and write rate limiters are enabled.public RemoteTableDescriptor<K,V,U> withReadRateLimiterDisabled()
public RemoteTableDescriptor<K,V,U> withWriteRateLimiterDisabled()
public RemoteTableDescriptor<K,V,U> withReadRateLimit(int creditsPerSec)
withRateLimiter(RateLimiter,
TableRateLimiter.CreditFunction, TableRateLimiter.CreditFunction)
and vice versa.
Note that this is the total credit of rate limit for the entire job, each task will get a per task
credit of creditsPerSec/tasksCount. Hence creditsPerSec should be greater than total number of tasks.creditsPerSec
- rate limit for read operations; must be positive and greater than total number taskspublic RemoteTableDescriptor<K,V,U> withWriteRateLimit(int creditsPerSec)
withRateLimiter(RateLimiter,
TableRateLimiter.CreditFunction, TableRateLimiter.CreditFunction)
and vice versa.
Note that this is the total credit of rate limit for the entire job, each task will get a per task
credit of creditsPerSec/tasksCount. Hence creditsPerSec should be greater than total number of tasks.creditsPerSec
- rate limit for write operations; must be positive and greater than total number taskspublic RemoteTableDescriptor<K,V,U> withAsyncCallbackExecutorPoolSize(int poolSize)
poolSize
- max number of threads in the executor for async callbackspublic RemoteTableDescriptor<K,V,U> withBatchProvider(BatchProvider<K,V,U> batchProvider)
public java.lang.String getProviderFactoryClassName()
BaseTableDescriptor
TableProviderFactory
getProviderFactoryClassName
in class BaseTableDescriptor<K,V,RemoteTableDescriptor<K,V,U>>
TableProviderFactory
public java.util.Map<java.lang.String,java.lang.String> toConfig(Config jobConfig)
TableDescriptor
jobConfig
.toConfig
in interface TableDescriptor<K,V,RemoteTableDescriptor<K,V,U>>
toConfig
in class BaseTableDescriptor<K,V,RemoteTableDescriptor<K,V,U>>
jobConfig
- job configurationprotected void validate()
BaseTableDescriptor
validate
in class BaseTableDescriptor<K,V,RemoteTableDescriptor<K,V,U>>
protected void addTablePartConfig(java.lang.String tablePartKey, TablePart tablePart, Config jobConfig, java.util.Map<java.lang.String,java.lang.String> tableConfig)
tablePartKey
- key of the table parttablePart
- table partjobConfig
- job configurationtableConfig
- table configuration