org.apache.hadoop.hive.thrift
Interface DelegationTokenStore

All Superinterfaces:
Closeable, org.apache.hadoop.conf.Configurable
All Known Implementing Classes:
DBTokenStore, MemoryTokenStore, ZooKeeperTokenStore

public interface DelegationTokenStore
extends org.apache.hadoop.conf.Configurable, Closeable

Interface for pluggable token store that can be implemented with shared external storage for load balancing and high availability (for example using ZooKeeper). Internal, store specific errors are translated into DelegationTokenStore.TokenStoreException.


Nested Class Summary
static class DelegationTokenStore.TokenStoreException
          Exception for internal token store errors that typically cannot be handled by the caller.
 
Method Summary
 int addMasterKey(String s)
          Add new master key.
 boolean addToken(DelegationTokenIdentifier tokenIdentifier, org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager.DelegationTokenInformation token)
          Add token.
 List<DelegationTokenIdentifier> getAllDelegationTokenIdentifiers()
          List of all token identifiers in the store.
 String[] getMasterKeys()
          Return all master keys.
 org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager.DelegationTokenInformation getToken(DelegationTokenIdentifier tokenIdentifier)
          Get token.
 boolean removeMasterKey(int keySeq)
          Remove key for given id.
 boolean removeToken(DelegationTokenIdentifier tokenIdentifier)
          Remove token.
 void setStore(Object hmsHandler)
           
 void updateMasterKey(int keySeq, String s)
          Update master key (for expiration and setting store assigned sequence within key)
 
Methods inherited from interface org.apache.hadoop.conf.Configurable
getConf, setConf
 
Methods inherited from interface java.io.Closeable
close
 

Method Detail

addMasterKey

int addMasterKey(String s)
                 throws DelegationTokenStore.TokenStoreException
Add new master key. The token store assigns and returns the sequence number. Caller needs to use the identifier to update the key (since it is embedded in the key).

Parameters:
s -
Returns:
sequence number for new key
Throws:
DelegationTokenStore.TokenStoreException

updateMasterKey

void updateMasterKey(int keySeq,
                     String s)
                     throws DelegationTokenStore.TokenStoreException
Update master key (for expiration and setting store assigned sequence within key)

Parameters:
keySeq -
s -
Throws:
DelegationTokenStore.TokenStoreException

removeMasterKey

boolean removeMasterKey(int keySeq)
Remove key for given id.

Parameters:
keySeq -
Returns:
false if key no longer present, true otherwise.

getMasterKeys

String[] getMasterKeys()
                       throws DelegationTokenStore.TokenStoreException
Return all master keys.

Returns:
Throws:
DelegationTokenStore.TokenStoreException

addToken

boolean addToken(DelegationTokenIdentifier tokenIdentifier,
                 org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager.DelegationTokenInformation token)
                 throws DelegationTokenStore.TokenStoreException
Add token. If identifier is already present, token won't be added.

Parameters:
tokenIdentifier -
token -
Returns:
true if token was added, false for existing identifier
Throws:
DelegationTokenStore.TokenStoreException

getToken

org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager.DelegationTokenInformation getToken(DelegationTokenIdentifier tokenIdentifier)
                                                                                                                     throws DelegationTokenStore.TokenStoreException
Get token. Returns null if the token does not exist.

Parameters:
tokenIdentifier -
Returns:
Throws:
DelegationTokenStore.TokenStoreException

removeToken

boolean removeToken(DelegationTokenIdentifier tokenIdentifier)
                    throws DelegationTokenStore.TokenStoreException
Remove token. Return value can be used by caller to detect concurrency.

Parameters:
tokenIdentifier -
Returns:
true if token was removed, false if it was already removed.
Throws:
DelegationTokenStore.TokenStoreException

getAllDelegationTokenIdentifiers

List<DelegationTokenIdentifier> getAllDelegationTokenIdentifiers()
                                                                 throws DelegationTokenStore.TokenStoreException
List of all token identifiers in the store. This is used to remove expired tokens and a potential scalability improvement would be to partition by master key id

Returns:
Throws:
DelegationTokenStore.TokenStoreException

setStore

void setStore(Object hmsHandler)
              throws DelegationTokenStore.TokenStoreException
Throws:
DelegationTokenStore.TokenStoreException


Copyright © 2014 The Apache Software Foundation. All rights reserved.