Created
June 19, 2014 16:50
-
-
Save angrycub/a9a5b5f27ad7f02129cb to your computer and use it in GitHub Desktop.
Streaming Bucket List with RJC. Reset `young_vclock` when negative.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package basho; | |
import java.io.IOException; | |
import com.basho.riak.client.IRiakClient; | |
import com.basho.riak.client.RiakException; | |
import com.basho.riak.client.RiakFactory; | |
import com.basho.riak.client.bucket.Bucket; | |
import com.basho.riak.client.query.StreamingOperation; | |
public class App { | |
public static void main(String[] args) throws RiakException, IOException { | |
IRiakClient riakClient = RiakFactory | |
.httpClient("http://127.0.0.1:8098/riak"); | |
StreamingOperation<String> bucketNames = riakClient | |
.listBucketsStreaming(); | |
for (String bucketName : bucketNames) { | |
Bucket thisBucket = riakClient.fetchBucket(bucketName).execute(); | |
System.out.print(thisBucket.getName() + " young_vclock = " | |
+ thisBucket.getYoungVClock()); | |
if (thisBucket.getYoungVClock() == -1L) { | |
riakClient.createBucket(thisBucket.getName()).youngVClock(20L) | |
.execute(); | |
System.out.printf(" -- RESET TO 20.%n"); | |
} else { | |
System.out.printf(".%n"); | |
} | |
} | |
riakClient.shutdown(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment