@InterfaceAudience.LimitedPrivate(value="S3A Filesystem and extensions") @InterfaceStability.Unstable public class StoreContext extends Object implements org.apache.hadoop.fs.store.audit.ActiveThreadSpanSource<org.apache.hadoop.fs.store.audit.AuditSpan>
ContextAccessors
interface, so tests can implement
their own.
Warning: this really is private and unstable. Do not use
outside the org.apache.hadoop.fs.s3a package, or in extension points
such as DelegationTokens.Modifier and Type | Method and Description |
---|---|
File |
createTempFile(String prefix,
long size)
Create a temporary file somewhere.
|
ExecutorService |
createThrottledExecutor()
Create a new executor with the capacity defined in
executorCapacity . |
ExecutorService |
createThrottledExecutor(int capacity)
Create a new executor service with a given capacity.
|
void |
decrementGauge(Statistic statistic,
long count)
Decrement a gauge by a specific value.
|
String |
fullKey(S3AFileStatus stat)
Build the full S3 key for a request from the status entry,
possibly adding a "/" if it represents directory and it does
not have a trailing slash already.
|
org.apache.hadoop.fs.store.audit.AuditSpan |
getActiveAuditSpan()
Return the active audit span.
|
org.apache.hadoop.fs.store.audit.AuditSpanSource<AuditSpanS3A> |
getAuditor()
Get the auditor.
|
String |
getBucket() |
String |
getBucketLocation()
Get the location of the bucket.
|
ChangeDetectionPolicy |
getChangeDetectionPolicy() |
org.apache.hadoop.conf.Configuration |
getConfiguration() |
ContextAccessors |
getContextAccessors() |
ExecutorService |
getExecutor() |
URI |
getFsURI() |
S3AInputPolicy |
getInputPolicy() |
S3AStatisticsContext |
getInstrumentation()
Get the statistics context for this StoreContext.
|
Invoker |
getInvoker() |
org.apache.hadoop.security.UserGroupInformation |
getOwner()
Get the owner of the filesystem.
|
RequestFactory |
getRequestFactory()
Get the request factory.
|
S3AStorageStatistics |
getStorageStatistics()
Get the storage statistics of this filesystem.
|
String |
getUsername() |
void |
incrementGauge(Statistic statistic,
long count)
Increment a gauge by a specific value.
|
void |
incrementStatistic(Statistic statistic)
Increment a statistic by 1.
|
void |
incrementStatistic(Statistic statistic,
long count)
Increment a statistic by a specific value.
|
boolean |
isCSEEnabled()
return if the store context have client side encryption enabled.
|
boolean |
isMultiObjectDeleteEnabled() |
boolean |
isUseListV1() |
org.apache.hadoop.fs.Path |
keyToPath(String key)
Convert a key to a fully qualified path.
|
org.apache.hadoop.fs.Path |
makeQualified(org.apache.hadoop.fs.Path path)
Qualify a path.
|
String |
pathToKey(org.apache.hadoop.fs.Path path)
Turns a path (relative or otherwise) into an S3 key.
|
<T> CompletableFuture<T> |
submit(CompletableFuture<T> future,
Callable<T> call)
Submit a closure for execution in the executor
returned by
getExecutor() . |
public URI getFsURI()
public String getBucket()
public org.apache.hadoop.conf.Configuration getConfiguration()
public String getUsername()
public ExecutorService getExecutor()
public Invoker getInvoker()
public S3AStatisticsContext getInstrumentation()
public S3AInputPolicy getInputPolicy()
public ChangeDetectionPolicy getChangeDetectionPolicy()
public boolean isMultiObjectDeleteEnabled()
public boolean isUseListV1()
public ContextAccessors getContextAccessors()
public org.apache.hadoop.fs.Path keyToPath(String key)
key
- input keypublic String pathToKey(org.apache.hadoop.fs.Path path)
path
- input path, may be relative to the working dirpublic org.apache.hadoop.fs.Path makeQualified(org.apache.hadoop.fs.Path path)
path
- path to qualify/normalizepublic S3AStorageStatistics getStorageStatistics()
public void incrementStatistic(Statistic statistic)
statistic
- The operation to incrementpublic void incrementStatistic(Statistic statistic, long count)
statistic
- The operation to incrementcount
- the count to incrementpublic void decrementGauge(Statistic statistic, long count)
statistic
- The operation to decrementcount
- the count to decrementpublic void incrementGauge(Statistic statistic, long count)
statistic
- The operation to incrementcount
- the count to incrementpublic ExecutorService createThrottledExecutor(int capacity)
executor
, using a
SemaphoredDelegatingExecutor
to limit the number
of requests coming in from a specific client.
Because this delegates to an existing thread pool, the cost of
creating a new instance here is low.
As the throttling is per instance, separate instances
should be created for each operation which wishes to execute work in
parallel without saturating the base executor.
This is important if either the duration of each operation is long
or the submission rate of work is high.capacity
- maximum capacity of this executor.public ExecutorService createThrottledExecutor()
executorCapacity
.public org.apache.hadoop.security.UserGroupInformation getOwner()
public File createTempFile(String prefix, long size) throws IOException
prefix
- prefix for the temporary filesize
- expected size.IOException
- failure.public String getBucketLocation() throws IOException
IOException
- failure.public String fullKey(S3AFileStatus stat)
stat
- status to build the key frompublic <T> CompletableFuture<T> submit(CompletableFuture<T> future, Callable<T> call)
getExecutor()
.T
- type of futurefuture
- future for the result.call
- callable to invoke.public org.apache.hadoop.fs.store.audit.AuditSpanSource<AuditSpanS3A> getAuditor()
public org.apache.hadoop.fs.store.audit.AuditSpan getActiveAuditSpan()
getActiveAuditSpan
in interface org.apache.hadoop.fs.store.audit.ActiveThreadSpanSource<org.apache.hadoop.fs.store.audit.AuditSpan>
public RequestFactory getRequestFactory()
public boolean isCSEEnabled()
Copyright © 2008–2024 Apache Software Foundation. All rights reserved.