public static BlobPath cleanPath() { return new BlobPath(); }
this.basePath = BlobPath.cleanPath();
public void testContainerCreationAndDeletion() throws IOException { try(BlobStore store = newBlobStore()) { final BlobContainer containerFoo = store.blobContainer(new BlobPath().add("foo")); final BlobContainer containerBar = store.blobContainer(new BlobPath().add("bar")); byte[] data1 = randomBytes(randomIntBetween(10, scaledRandomIntBetween(1024, 1 << 16))); byte[] data2 = randomBytes(randomIntBetween(10, scaledRandomIntBetween(1024, 1 << 16))); writeBlob(containerFoo, "test", new BytesArray(data1)); writeBlob(containerBar, "test", new BytesArray(data2)); assertArrayEquals(readBlobFully(containerFoo, "test", data1.length), data1); assertArrayEquals(readBlobFully(containerBar, "test", data2.length), data2); assertTrue(containerFoo.blobExists("test")); assertTrue(containerBar.blobExists("test")); store.delete(new BlobPath()); assertFalse(containerFoo.blobExists("test")); assertFalse(containerBar.blobExists("test")); } }
private Path buildPath(BlobPath path) { String[] paths = path.toArray(); if (paths.length == 0) { return path(); } Path blobPath = this.path.resolve(paths[0]); if (paths.length > 1) { for (int i = 1; i < paths.length; i++) { blobPath = blobPath.resolve(paths[i]); } } return blobPath; } }
public S3BlobContainer(BlobPath path, S3BlobStore blobStore) { super(path); this.blobStore = blobStore; String keyPath = path.buildAsString("/"); if (!keyPath.isEmpty()) { keyPath = keyPath + "/"; } this.keyPath = keyPath; }
private Path buildPath(BlobPath path) { String[] paths = path.toArray(); if (paths.length == 0) { return path(); } Path blobPath = this.path.resolve(paths[0]); if (paths.length > 1) { for (int i = 1; i < paths.length; i++) { blobPath = blobPath.resolve(paths[i]); } } return blobPath; } }
list = client.listNextBatchOfObjects(prevListing); } else { String keyPath = path.buildAsString("/"); if (!keyPath.isEmpty()) { keyPath = keyPath + "/";
public BlobPath add(String path) { List<String> paths = new ArrayList<>(this.paths); paths.add(path); return new BlobPath(Collections.unmodifiableList(paths)); }
/** * Constructs a read-only URL-based repository */ public URLRepository(RepositoryMetaData metadata, Environment environment, NamedXContentRegistry namedXContentRegistry) throws IOException { super(metadata, environment.settings(), namedXContentRegistry); if (URL_SETTING.exists(metadata.settings()) == false && REPOSITORIES_URL_SETTING.exists(settings) == false) { throw new RepositoryException(metadata.name(), "missing url"); } supportedProtocols = SUPPORTED_PROTOCOLS_SETTING.get(settings); urlWhiteList = ALLOWED_URLS_SETTING.get(settings).toArray(new URIPattern[]{}); this.environment = environment; URL url = URL_SETTING.exists(metadata.settings()) ? URL_SETTING.get(metadata.settings()) : REPOSITORIES_URL_SETTING.get(settings); URL normalizedURL = checkURL(url); blobStore = new URLBlobStore(settings, normalizedURL); basePath = BlobPath.cleanPath(); }
private Path buildPath(BlobPath path) { String[] paths = path.toArray(); if (paths.length == 0) { return path(); } Path blobPath = this.path.resolve(paths[0]); if (paths.length > 1) { for (int i = 1; i < paths.length; i++) { blobPath = blobPath.resolve(paths[i]); } } return blobPath; } }
private void deleteIndexMetaDataBlobIgnoringErrors(final SnapshotInfo snapshotInfo, final IndexId indexId) { final SnapshotId snapshotId = snapshotInfo.snapshotId(); BlobContainer indexMetaDataBlobContainer = blobStore().blobContainer(basePath().add("indices").add(indexId.getId())); try { indexMetaDataFormat.delete(indexMetaDataBlobContainer, snapshotId.getUUID()); } catch (IOException ex) { logger.warn(() -> new ParameterizedMessage("[{}] failed to delete metadata for index [{}]", snapshotId, indexId.getName()), ex); } }
public static BlobPath cleanPath() { return new BlobPath(); }
this.basePath = BlobPath.cleanPath();
private Path buildPath(BlobPath path) { String[] paths = path.toArray(); if (paths.length == 0) { return path(); } Path blobPath = this.path.resolve(paths[0]); if (paths.length > 1) { for (int i = 1; i < paths.length; i++) { blobPath = blobPath.resolve(paths[i]); } } return blobPath; } }
@Override public void endVerification(String seed) { if (isReadOnly() == false) { try { blobStore().delete(basePath().add(testBlobPrefix(seed))); } catch (IOException exp) { throw new RepositoryVerificationException(metadata.name(), "cannot delete test data at " + basePath(), exp); } } }
public static BlobPath cleanPath() { return new BlobPath(); }
this.basePath = BlobPath.cleanPath();