HDDS-937. Create an S3 Auth Table. Contributed by Dinesh Chitlangia.

This commit is contained in:
Bharat Viswanadham 2018-12-21 13:26:34 -08:00 committed by Xiaoyu Yao
parent 50c4045fde
commit ddaef67181
2 changed files with 21 additions and 0 deletions

View File

@ -254,6 +254,7 @@ List<OmVolumeArgs> listVolumes(String userName, String prefix,
Table<byte[], byte[]> getS3Table(); Table<byte[], byte[]> getS3Table();
/** /**
<<<<<<< HEAD
* Returns the DB key name of a multipart upload key in OM metadata store. * Returns the DB key name of a multipart upload key in OM metadata store.
* *
* @param volume - volume name * @param volume - volume name
@ -273,6 +274,12 @@ String getMultipartKey(String volume, String bucket, String key, String
*/ */
Table<String, OmMultipartKeyInfo> getMultipartInfoTable(); Table<String, OmMultipartKeyInfo> getMultipartInfoTable();
/**
* Gets the S3 Secrets table.
* @return Table
*/
Table<byte[], byte[]> getS3SecretTable();
/** /**
* Returns number of rows in a table. This should not be used for very * Returns number of rows in a table. This should not be used for very
* large tables. * large tables.

View File

@ -59,6 +59,8 @@
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.ws.rs.HEAD;
/** /**
* Ozone metadata manager interface. * Ozone metadata manager interface.
*/ */
@ -89,6 +91,8 @@ public class OmMetadataManagerImpl implements OMMetadataManager {
* |-------------------------------------------------------------------| * |-------------------------------------------------------------------|
* | s3Table | s3BucketName -> /volumeName/bucketName | * | s3Table | s3BucketName -> /volumeName/bucketName |
* |-------------------------------------------------------------------| * |-------------------------------------------------------------------|
* | s3SecretTable | s3g_access_key_id -> s3Secret |
* |-------------------------------------------------------------------|
*/ */
private static final String USER_TABLE = "userTable"; private static final String USER_TABLE = "userTable";
@ -99,6 +103,7 @@ public class OmMetadataManagerImpl implements OMMetadataManager {
private static final String OPEN_KEY_TABLE = "openKeyTable"; private static final String OPEN_KEY_TABLE = "openKeyTable";
private static final String S3_TABLE = "s3Table"; private static final String S3_TABLE = "s3Table";
private static final String MULTIPARTINFO_TABLE = "multipartInfoTable"; private static final String MULTIPARTINFO_TABLE = "multipartInfoTable";
private static final String S3_SECRET_TABLE = "s3SecretTable";
private DBStore store; private DBStore store;
@ -113,6 +118,7 @@ public class OmMetadataManagerImpl implements OMMetadataManager {
private Table openKeyTable; private Table openKeyTable;
private Table s3Table; private Table s3Table;
private Table<String, OmMultipartKeyInfo> multipartInfoTable; private Table<String, OmMultipartKeyInfo> multipartInfoTable;
private Table s3SecretTable;
public OmMetadataManagerImpl(OzoneConfiguration conf) throws IOException { public OmMetadataManagerImpl(OzoneConfiguration conf) throws IOException {
this.lock = new OzoneManagerLock(conf); this.lock = new OzoneManagerLock(conf);
@ -195,6 +201,7 @@ public void start(OzoneConfiguration configuration) throws IOException {
.addTable(OPEN_KEY_TABLE) .addTable(OPEN_KEY_TABLE)
.addTable(S3_TABLE) .addTable(S3_TABLE)
.addTable(MULTIPARTINFO_TABLE) .addTable(MULTIPARTINFO_TABLE)
.addTable(S3_SECRET_TABLE)
.addCodec(OmKeyInfo.class, new OmKeyInfoCodec()) .addCodec(OmKeyInfo.class, new OmKeyInfoCodec())
.addCodec(OmBucketInfo.class, new OmBucketInfoCodec()) .addCodec(OmBucketInfo.class, new OmBucketInfoCodec())
.addCodec(OmVolumeArgs.class, new OmVolumeArgsCodec()) .addCodec(OmVolumeArgs.class, new OmVolumeArgsCodec())
@ -233,6 +240,8 @@ public void start(OzoneConfiguration configuration) throws IOException {
String.class, OmMultipartKeyInfo.class); String.class, OmMultipartKeyInfo.class);
checkTableStatus(multipartInfoTable, MULTIPARTINFO_TABLE); checkTableStatus(multipartInfoTable, MULTIPARTINFO_TABLE);
s3SecretTable = this.store.getTable(S3_SECRET_TABLE);
checkTableStatus(s3SecretTable, S3_SECRET_TABLE);
} }
} }
@ -655,4 +664,9 @@ public <KEY, VALUE> long countRowsInTable(Table<KEY, VALUE> table)
} }
return count; return count;
} }
@Override
public Table<byte[], byte[]> getS3SecretTable() {
return s3SecretTable;
}
} }