ISessionContainer Interface
public interface ISessionContainer
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
clearTokenByCollectionFullName(String collectionFullName)
Atomically: removes partitionKeyRangeId token map associated with collectionFullName, maps collectionFullName to resourceId and removes its map as well. |
void |
clearTokenByResourceId(String resourceId)
Atomically: removes partitionKeyRangeId token map associated with resourceId, maps resourceId to collectionFullName and removes its map as well |
String |
resolveGlobalSessionToken(RxDocumentServiceRequest entity)
Returns a serialized map of partitionKeyRangeId to session token. If a entity is name based then the method extracts name from ResourceAddress and use it to identify collection otherwise it uses ResourceId. Returns empty string if collection is unknown |
ISessionToken |
resolvePartitionLocalSessionToken(RxDocumentServiceRequest entity, String partitionKeyRangeId)
Returns a session token identified by partitionKeyRangeId(*) from a collection identified either by ResourceAddress (in case of name based entity) or either by ResourceId. If partitionKeyRangeId is not in the collection's partitionKeyRangeId token map then method iterates through request.RequestContext.ResolvedPartitionKeyRange.Parents starting from tail and returns a corresponding token if there is a match. |
void |
setSessionToken(RxDocumentServiceRequest request, Map<String, String> responseHeaders)
Infers collectionFullName using responseHeaders[HttpConstants.HttpHeaders.OwnerFullName] or request.ResourceAddress, infers resourceId using responseHeaders[HttpConstants.HttpHeaders.OwnerId] or request.ResourceId, and adds responseHeaders[HttpConstants.HttpHeaders.SessionToken] session token to the (collectionFullName, resourceId)'s partitionKeyRangeId token map. NB: Silently does nothing for master queries, or when it's impossible to infer collectionRid and collectionFullName from the request, or then SessionToken is missing in responseHeader. |
void |
setSessionToken(String collectionRid, String collectionFullName, Map<String, String> responseHeaders)
Adds responseHeaders[HttpConstants.HttpHeaders.SessionToken] session token to the (collectionFullName, collectionRid)'s partitionKeyRangeId token map. |
Method Details
clearTokenByCollectionFullName
public void clearTokenByCollectionFullName(String collectionFullName)
Atomically: removes partitionKeyRangeId token map associated with collectionFullName, maps collectionFullName to resourceId and removes its map as well.
Parameters:
clearTokenByResourceId
public void clearTokenByResourceId(String resourceId)
Atomically: removes partitionKeyRangeId token map associated with resourceId, maps resourceId to collectionFullName and removes its map as well
Parameters:
resolveGlobalSessionToken
public String resolveGlobalSessionToken(RxDocumentServiceRequest entity)
Returns a serialized map of partitionKeyRangeId to session token. If a entity is name based then the method extracts name from ResourceAddress and use it to identify collection otherwise it uses ResourceId. Returns empty string if collection is unknown
Parameters:
entity
Returns:
resolvePartitionLocalSessionToken
public ISessionToken resolvePartitionLocalSessionToken(RxDocumentServiceRequest entity, String partitionKeyRangeId)
Returns a session token identified by partitionKeyRangeId(*) from a collection identified either by ResourceAddress (in case of name based entity) or either by ResourceId.
If partitionKeyRangeId is not in the collection's partitionKeyRangeId token map then method iterates through request.RequestContext.ResolvedPartitionKeyRange.Parents starting from tail and returns a corresponding token if there is a match.
Parameters:
RxDocumentServiceRequest
Returns:
setSessionToken
public void setSessionToken(RxDocumentServiceRequest request, Map
Infers collectionFullName using responseHeaders[HttpConstants.HttpHeaders.OwnerFullName] or request.ResourceAddress, infers resourceId using responseHeaders[HttpConstants.HttpHeaders.OwnerId] or request.ResourceId, and adds responseHeaders[HttpConstants.HttpHeaders.SessionToken] session token to the (collectionFullName, resourceId)'s partitionKeyRangeId token map.
NB: Silently does nothing for master queries, or when it's impossible to infer collectionRid and collectionFullName from the request, or then SessionToken is missing in responseHeader.
Parameters:
RxDocumentServiceRequest
setSessionToken
public void setSessionToken(String collectionRid, String collectionFullName, Map
Adds responseHeaders[HttpConstants.HttpHeaders.SessionToken] session token to the (collectionFullName, collectionRid)'s partitionKeyRangeId token map.
Parameters:
Applies to
Azure SDK for Java