public class LocalFsBlobStore extends BlobStore
Provides a local file system backed blob store implementation for Nimbus.
For a local blob store the user and the supervisor use NimbusBlobStore Client API in order to talk to nimbus through thrift. The authentication and authorization here is based on the subject. We currently have NIMBUS_ADMINS and SUPERVISOR_ADMINS configuration. NIMBUS_ADMINS are given READ, WRITE and ADMIN access whereas the SUPERVISOR_ADMINS are given READ access in order to read and download the blobs form the nimbus.
The ACLs for the blob store are validated against whether the subject is a NIMBUS_ADMIN, SUPERVISOR_ADMIN or USER who has read, write or admin privileges in order to perform respective operations on the blob.
For local blob store 1. The USER interacts with nimbus to upload and access blobs through NimbusBlobStore Client API. 2. The USER sets the ACLs, and the blob access is validated against these ACLs. 3. The SUPERVISOR interacts with nimbus through the NimbusBlobStore Client API to download the blobs. The supervisors principal should match the set of users configured into SUPERVISOR_ADMINS. Here, the PrincipalToLocalPlugin takes care of mapping the principal to user name before the ACL validation.
BlobStore.BlobStoreFileInputStream, BlobStore.BlobStoreFileOutputStream, BlobStore.KeyTranslationIterator| Modifier and Type | Field and Description |
|---|---|
protected BlobStoreAclHandler |
_aclHandler |
static org.slf4j.Logger |
LOG |
BASE_BLOBS_DIR_NAME| Constructor and Description |
|---|
LocalFsBlobStore() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkForBlobOrDownload(String key) |
void |
checkForBlobUpdate(String key) |
AtomicOutputStream |
createBlob(String key,
SettableBlobMeta meta,
Subject who)
Creates the blob.
|
void |
deleteBlob(String key,
Subject who)
Deletes the blob data and metadata.
|
void |
fullCleanup(long age) |
InputStreamWithMeta |
getBlob(String key,
Subject who)
Gets the InputStream to read the blob details
|
ReadableBlobMeta |
getBlobMeta(String key,
Subject who)
Gets the current version of metadata for a blob to be viewed by the user or downloaded by the supervisor.
|
int |
getBlobReplication(String key,
Subject who)
Gets the replication factor of the blob.
|
Iterator<String> |
listKeys()
Returns an iterator with all the list of keys currently available on the blob store.
|
void |
prepare(Map conf,
String overrideBase,
NimbusInfo nimbusInfo)
Allows us to initialize the blob store
|
void |
setBlobMeta(String key,
SettableBlobMeta meta,
Subject who)
Sets the metadata with renewed acls for the blob.
|
void |
shutdown() |
AtomicOutputStream |
updateBlob(String key,
Subject who)
Updates the blob data.
|
int |
updateBlobReplication(String key,
int replication,
Subject who)
Modifies the replication factor of the blob.
|
createBlob, createBlob, filterAndListKeys, readBlob, readBlobTo, validateKeypublic static final org.slf4j.Logger LOG
protected BlobStoreAclHandler _aclHandler
public void prepare(Map conf, String overrideBase, NimbusInfo nimbusInfo)
BlobStoreAllows us to initialize the blob store
public AtomicOutputStream createBlob(String key, SettableBlobMeta meta, Subject who) throws AuthorizationException, KeyAlreadyExistsException
BlobStoreCreates the blob.
createBlob in class BlobStorekey - Key for the blob.meta - Metadata which contains the acls informationwho - Is the subject creating the blob.AuthorizationExceptionKeyAlreadyExistsExceptionpublic AtomicOutputStream updateBlob(String key, Subject who) throws AuthorizationException, KeyNotFoundException
BlobStoreUpdates the blob data.
updateBlob in class BlobStorekey - Key for the blob.who - Is the subject having the write privilege for the blob.AuthorizationExceptionKeyNotFoundExceptionpublic ReadableBlobMeta getBlobMeta(String key, Subject who) throws AuthorizationException, KeyNotFoundException
BlobStoreGets the current version of metadata for a blob to be viewed by the user or downloaded by the supervisor.
getBlobMeta in class BlobStorekey - Key for the blob.who - Is the subject having the read privilege for the blob.AuthorizationExceptionKeyNotFoundExceptionpublic void setBlobMeta(String key, SettableBlobMeta meta, Subject who) throws AuthorizationException, KeyNotFoundException
BlobStoreSets the metadata with renewed acls for the blob.
setBlobMeta in class BlobStorekey - Key for the blob.meta - Metadata which contains the updated acls information.who - Is the subject having the write privilege for the blob.AuthorizationExceptionKeyNotFoundExceptionpublic void deleteBlob(String key, Subject who) throws AuthorizationException, KeyNotFoundException
BlobStoreDeletes the blob data and metadata.
deleteBlob in class BlobStorekey - Key for the blob.who - Is the subject having write privilege for the blob.AuthorizationExceptionKeyNotFoundExceptionpublic InputStreamWithMeta getBlob(String key, Subject who) throws AuthorizationException, KeyNotFoundException
BlobStoreGets the InputStream to read the blob details
getBlob in class BlobStorekey - Key for the blob.who - Is the subject having the read privilege for the blob.AuthorizationExceptionKeyNotFoundExceptionpublic Iterator<String> listKeys()
BlobStoreReturns an iterator with all the list of keys currently available on the blob store.
public void shutdown()
public int getBlobReplication(String key, Subject who) throws Exception
BlobStoreGets the replication factor of the blob.
getBlobReplication in class BlobStorekey - Key for the blob.who - Is the subject having the read privilege for the blob.Exceptionpublic int updateBlobReplication(String key, int replication, Subject who) throws AuthorizationException, KeyNotFoundException
BlobStoreModifies the replication factor of the blob.
updateBlobReplication in class BlobStorekey - Key for the blob.replication - The replication factor the blob has to be set.who - Is the subject having the update privilege for the blobAuthorizationExceptionKeyNotFoundExceptionpublic boolean checkForBlobOrDownload(String key) throws KeyNotFoundException
KeyNotFoundExceptionpublic void checkForBlobUpdate(String key)
public void fullCleanup(long age)
throws IOException
IOExceptionCopyright © 2019 The Apache Software Foundation. All Rights Reserved.