@InterfaceAudience.Private @InterfaceStability.Unstable public class StoreContext extends Object
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.Constructor and Description |
---|
StoreContext(URI fsURI,
String bucket,
org.apache.hadoop.conf.Configuration configuration,
String username,
org.apache.hadoop.security.UserGroupInformation owner,
com.google.common.util.concurrent.ListeningExecutorService executor,
int executorCapacity,
Invoker invoker,
S3AInstrumentation instrumentation,
S3AStorageStatistics storageStatistics,
S3AInputPolicy inputPolicy,
ChangeDetectionPolicy changeDetectionPolicy,
boolean multiObjectDeleteEnabled,
MetadataStore metadataStore,
boolean useListV1,
ContextAccessors contextAccessors,
ITtlTimeProvider timeProvider)
Instantiate.
|
Modifier and Type | Method and Description |
---|---|
protected Object |
clone() |
File |
createTempFile(String prefix,
long size)
Create a temporary file somewhere.
|
com.google.common.util.concurrent.ListeningExecutorService |
createThrottledExecutor()
Create a new executor with the capacity defined in
executorCapacity . |
com.google.common.util.concurrent.ListeningExecutorService |
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.
|
String |
getBucket() |
String |
getBucketLocation()
Get the location of the bucket.
|
ChangeDetectionPolicy |
getChangeDetectionPolicy() |
org.apache.hadoop.conf.Configuration |
getConfiguration() |
com.google.common.util.concurrent.ListeningExecutorService |
getExecutor() |
URI |
getFsURI() |
S3AInputPolicy |
getInputPolicy() |
S3AInstrumentation |
getInstrumentation() |
Invoker |
getInvoker() |
MetadataStore |
getMetadataStore() |
org.apache.hadoop.security.UserGroupInformation |
getOwner()
Get the owner of the filesystem.
|
S3AStorageStatistics |
getStorageStatistics()
Get the storage statistics of this filesystem.
|
ITtlTimeProvider |
getTimeProvider()
Get the time provider.
|
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 |
isMultiObjectDeleteEnabled() |
boolean |
isUseListV1() |
org.apache.hadoop.fs.Path |
keyToPath(String key)
Convert a key to a fully qualified path.
|
String |
pathToKey(org.apache.hadoop.fs.Path path)
Turns a path (relative or otherwise) into an S3 key.
|
public StoreContext(URI fsURI, String bucket, org.apache.hadoop.conf.Configuration configuration, String username, org.apache.hadoop.security.UserGroupInformation owner, com.google.common.util.concurrent.ListeningExecutorService executor, int executorCapacity, Invoker invoker, S3AInstrumentation instrumentation, S3AStorageStatistics storageStatistics, S3AInputPolicy inputPolicy, ChangeDetectionPolicy changeDetectionPolicy, boolean multiObjectDeleteEnabled, MetadataStore metadataStore, boolean useListV1, ContextAccessors contextAccessors, ITtlTimeProvider timeProvider)
protected Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public URI getFsURI()
public String getBucket()
public org.apache.hadoop.conf.Configuration getConfiguration()
public String getUsername()
public com.google.common.util.concurrent.ListeningExecutorService getExecutor()
public Invoker getInvoker()
public S3AInstrumentation getInstrumentation()
public S3AInputPolicy getInputPolicy()
public ChangeDetectionPolicy getChangeDetectionPolicy()
public boolean isMultiObjectDeleteEnabled()
public MetadataStore getMetadataStore()
public boolean isUseListV1()
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 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 com.google.common.util.concurrent.ListeningExecutorService 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 com.google.common.util.concurrent.ListeningExecutorService 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 ITtlTimeProvider getTimeProvider()
public String fullKey(S3AFileStatus stat)
stat
- status to build the key fromCopyright © 2008–2020 Apache Software Foundation. All rights reserved.