Package org.jgroups.protocols
Class S3_PING
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.Discovery
org.jgroups.protocols.FILE_PING
org.jgroups.protocols.S3_PING
Discovery protocol using Amazon's S3 storage. The S3 access code reuses the example shipped by Amazon.
This protocol is unsupported and experimental !
- Author:
- Bela Ban
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jgroups.protocols.FILE_PING
FILE_PING.WriterTaskNested classes/interfaces inherited from class org.jgroups.protocols.Discovery
Discovery.Responses -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected org.jgroups.protocols.S3_PING.AWSAuthConnectionprotected Stringprotected Stringprotected Stringprotected StringFields inherited from class org.jgroups.protocols.FILE_PING
filter, interval, location, root_dir, SUFFIXFields inherited from class org.jgroups.protocols.Discovery
group_addr, local_addr, members, ping_responses, rank, timer, view -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidstatic StringgeneratePreSignedUrl(String awsAccessKey, String awsSecretAccessKey, String method, String bucket, String key, long expirationDate) Use this helper method to generate pre-signed S3 urls for use with S3_PING.voidinit()Called after instance has been created (null constructor) and before protocol is started.Reads all information from the given directory under clusternameprotected voidprotected booleanprotected voidprotected voidwriteToFile(PingData data, String clustername) Methods inherited from class org.jgroups.protocols.FILE_PING
addressAsString, down, handleView, readFile, sendGetMembersRequest, start, stopMethods inherited from class org.jgroups.protocols.Discovery
discoveryRequestReceived, findAllMembers, findAllViews, findAllViewsAsString, findInitialMembers, findInitialMembers, findInitialMembersAsString, getNumberOfDiscoveryRequestsSent, getNumInitialMembers, getNumPingRequests, getTimeout, getView, handleConnect, handleDisconnect, makeView, providedUpServices, resetStats, setNumInitialMembers, setNumPingRequests, setTimeout, upMethods inherited from class org.jgroups.stack.Protocol
destroy, downThreadEnabled, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProperties, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, isErgonomics, printStats, providedDownServices, requiredDownServices, requiredUpServices, setDownProtocol, setErgonomics, setId, setLevel, setProperties, setPropertiesInternal, setProperty, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled, upThreadEnabled
-
Field Details
-
access_key
-
secret_access_key
-
prefix
-
pre_signed_put_url
-
pre_signed_delete_url
-
conn
protected org.jgroups.protocols.S3_PING.AWSAuthConnection conn
-
-
Constructor Details
-
S3_PING
public S3_PING()
-
-
Method Details
-
init
Description copied from class:ProtocolCalled after instance has been created (null constructor) and before protocol is started. Properties are already set. Other protocols are not yet connected and events cannot yet be sent. -
createRootDir
protected void createRootDir()- Overrides:
createRootDirin classFILE_PING
-
readAll
Description copied from class:FILE_PINGReads all information from the given directory under clustername -
writeToFile
- Overrides:
writeToFilein classFILE_PING
-
remove
-
validateProperties
protected void validateProperties() -
usingPreSignedUrls
protected boolean usingPreSignedUrls() -
generatePreSignedUrl
public static String generatePreSignedUrl(String awsAccessKey, String awsSecretAccessKey, String method, String bucket, String key, long expirationDate) Use this helper method to generate pre-signed S3 urls for use with S3_PING. You'll need to generate urls for both the put and delete http methods. Example: Your AWS Access Key is "abcd". Your AWS Secret Access Key is "efgh". You want this node to write its information to "/S3_PING/DemoCluster/node1". So, your bucket is "S3_PING" and your key is "DemoCluster/node1". You want this to expire one year from now, or (System.currentTimeMillis / 1000) + (60 * 60 * 24 * 365) Let's assume that this equals 1316286684 Here's how to generate the value for the pre_signed_put_url property: String putUrl = S3_PING.generatePreSignedUrl("abcd", "efgh", "put", "S3_Ping", "DemoCluster/node1", 1316286684); Here's how to generate the value for the pre_signed_delete_url property: String deleteUrl = S3_PING.generatePreSignedUrl("abcd", "efgh", "delete", "S3_Ping", "DemoCluster/node1", 1316286684);- Parameters:
awsAccessKey- Your AWS Access KeyawsSecretAccessKey- Your AWS Secret Access Keymethod- The HTTP method - use "put" or "delete" for use with S3_PINGbucket- The S3 bucket you want to write tokey- The key within the bucket to write toexpirationDate- The date this pre-signed url should expire, in seconds since epoch- Returns:
- The pre-signed url to be used in pre_signed_put_url or pre_signed_delete_url properties
-