return bucketFactory.createWithIndexDirectoryAndFormat(index,
new File(path), BucketFormat.SPLUNK_BUCKET);
}
private List<BucketLock> createBucketLocks(LocalBucket bucket) {
BucketLock bucketLock = bucketLocker.getLockForBucket(bucket);
if (!bucketLock.tryLockShared())
throw new IllegalStateException("We must ensure that the"
+ " bucket archiver has a " + "lock to the bucket it will transfer");
BucketLock transferLock = new BucketTransferLocker(
LocalFileSystemPaths.create()).getLockForBucket(bucket);
if (!transferLock.tryLockExclusive())
throw new RuntimeException("Could not transfer bucket: " + bucket
+ ", because transfer lock was not accquired");
return asList(bucketLock, transferLock);
}