/** * Reads an object from S3. * @param bucket The name of the bucket where the object lives. * @param key The name of the key to use. * @param headers A Map of String to List of Strings representing the http * headers to pass (can be null). */ public GetResponse get(String bucket, String key, Map headers) throws IOException { return new GetResponse(makeRequest("GET", bucket, Utils.urlencode(key), null, headers)); }
/** * Deletes an object from S3. * @param bucket The name of the bucket where the object lives. * @param key The name of the key to use. * @param headers A Map of String to List of Strings representing the http * headers to pass (can be null). */ public Response delete(String bucket, String key, Map headers) throws IOException { return new Response(makeRequest("DELETE", bucket, Utils.urlencode(key), null, headers)); }
public void run() { try { _run(); } finally { discard_requests=false; } Request req=new ResendPendingRequests(); sendRequest(null, req); }
protected static Request createRequest(RequestType type) { switch(type) { case COMPARE_AND_SET: return new CompareAndSetRequest(); case ADD_AND_GET: return new AddAndGetRequest(); case UPDATE: return new UpdateRequest(); case GET_OR_CREATE: return new GetOrCreateRequest(); case DELETE: return new DeleteRequest(); case SET: return new SetRequest(); case RECONCILE: return new ReconcileRequest(); case RESEND_PENDING_REQUESTS: return new ResendPendingRequests(); default: throw new IllegalArgumentException("failed creating a request from " + type); } }
protected static Response createResponse(ResponseType type) { switch(type) { case VOID: return new SimpleResponse(); case GET_OR_CREATE: return new GetOrCreateResponse(); case BOOLEAN: return new BooleanResponse(); case VALUE: return new ValueResponse(); case EXCEPTION: return new ExceptionResponse(); case RECONCILE: return new ReconcileResponse(); default: throw new IllegalArgumentException("failed creating a response from " + type); } }
public void doSend(byte[] buf, int offset, int length, Address dest) throws Exception { if(stats) { msg_stats.incrNumMsgsSent(1); msg_stats.incrNumBytesSent(length); } if(dest == null) sendMulticast(buf, offset, length); else sendToSingleMember(dest, buf, offset, length); }
public void stop() { super.stop(); stopInfoWriter(); remove(cluster_name, local_addr); }
static CallingFormat getCallingFormatForBucket(CallingFormat desiredFormat, String bucketName) { CallingFormat callingFormat=desiredFormat; if(callingFormat == CallingFormat.getSubdomainCallingFormat() && !Utils.isValidSubdomainBucketName(bucketName)) { callingFormat=CallingFormat.getPathCallingFormat(); } return callingFormat; }
public void stop() { super.stop(); is_server=is_coord=false; unregister(cluster_name, local_addr); }
protected void updateBackups(Type type, Owner obj) { synchronized(backups) { for(Address backup: backups) sendRequest(backup, type, obj.getRequestId(), obj.getAddress()); } }
public void destroy() { super.destroy(); // We cannot clear the routing table, as it is shared between channels, and so we would clear the routing for // a different channel, too ! unregister(cluster_name, local_addr); }
protected void handleLockDeniedResponse(String lock_name, int lock_id, Owner owner) { ClientLock lock=client_lock_table.getLock(lock_name,owner,false); if(lock != null) lock.lockDenied(lock_id); }
/** * Deletes a bucket. * @param bucket The name of the bucket to delete. * @param headers A Map of String to List of Strings representing the http headers to pass (can be null). */ public Response deleteBucket(String bucket, Map headers) throws IOException { return new Response(makeRequest("DELETE", bucket, "", null, headers)); }
@Override protected void remove(String clustername, Address addr) { String fileName = clustername + "/" + addressToFilename(addr); rackspaceClient.deleteObject(container, fileName); }
/** * List all the buckets created by this account. * @param headers A Map of String to List of Strings representing the http * headers to pass (can be null). */ public ListAllMyBucketsResponse listAllMyBuckets(Map headers) throws IOException { return new ListAllMyBucketsResponse(makeRequest("GET", "", "", null, headers)); }
@Override public void init() throws Exception { if (this.secret_key == null) { readSecretKeyFromKeystore(); } super.init(); }
protected void handleLockGrantedResponse(String lock_name, int lock_id, Owner owner) { ClientLock lock=client_lock_table.getLock(lock_name,owner,false); if(lock != null) lock.handleLockGrantedResponse(lock_id); }
protected void handleLockReleasedResponse(String lock_name, int lock_id, Owner owner) { ClientLock lock=client_lock_table.getLock(lock_name,owner,false); if(lock != null) lock.handleLockReleasedResponse(lock_id); }