Skip to content

Commit

Permalink
WIP. More spotlessApply
Browse files Browse the repository at this point in the history
  • Loading branch information
david-ry4n committed Oct 3, 2024
1 parent 34dd6bc commit 7cbfd4b
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ protected SafeFuture<?> doStart() {
}
}

final DataArchive dataArchive = config.getBlobsArchivePath()
.map( path->(DataArchive) new FileSystemArchive(Path.of(path)))
final DataArchive dataArchive =
config
.getBlobsArchivePath()
.map(path -> (DataArchive) new FileSystemArchive(Path.of(path)))
.orElse(new NoopDataArchive());

if (config.getSpec().isMilestoneSupported(SpecMilestone.DENEB)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@

package tech.pegasys.teku.storage.archive;

import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecar;

import java.io.IOException;
import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecar;

/**
* Interface for a data archive which stores non-current BlobSidecars and could be extended later to
Expand All @@ -25,12 +24,11 @@
*/
public interface DataArchive {

/**
* Returns the archive writer capable of storing BlobSidecars.
*
* @return a closeable DataArchiveWriter for writing BlobSidecars
* @throws IOException
*/
DataArchiveWriter<BlobSidecar> getBlobSidecarWriter() throws IOException;

/**
* Returns the archive writer capable of storing BlobSidecars.
*
* @return a closeable DataArchiveWriter for writing BlobSidecars
* @throws IOException
*/
DataArchiveWriter<BlobSidecar> getBlobSidecarWriter() throws IOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import tech.pegasys.teku.spec.datastructures.blocks.SlotAndBlockRoot;
import tech.pegasys.teku.storage.archive.DataArchive;
import tech.pegasys.teku.storage.archive.DataArchiveWriter;
import tech.pegasys.teku.storage.archive.DataArchiveWriterFactory;

/**
* A file system based implementations of the DataArchive. Writes to a directory using the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
/*
* Copyright Consensys Software Inc., 2024
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.storage.archive.nooparchive;

import java.io.IOException;
import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecar;
import tech.pegasys.teku.storage.archive.DataArchive;
import tech.pegasys.teku.storage.archive.DataArchiveNoopWriter;
import tech.pegasys.teku.storage.archive.DataArchiveWriter;

import java.io.IOException;

public class NoopDataArchive implements DataArchive {

@Override
public DataArchiveWriter<BlobSidecar> getBlobSidecarWriter() throws IOException {
return DataArchiveNoopWriter.NOOP_BLOBSIDECAR_STORE;
}
@Override
public DataArchiveWriter<BlobSidecar> getBlobSidecarWriter() throws IOException {
return DataArchiveNoopWriter.NOOP_BLOBSIDECAR_STORE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ public int getBlobsPruningLimit() {
return blobsPruningLimit;
}

public Optional<String> getBlobsArchivePath() { return Optional.ofNullable(blobsArchivePath); }
public Optional<String> getBlobsArchivePath() {
return Optional.ofNullable(blobsArchivePath);
}

public long getRetainedSlots() {
return retainedSlots;
Expand Down Expand Up @@ -286,7 +288,7 @@ public Builder blobsArchivePath(final String blobsArchivePath) {
File file = Path.of(blobsArchivePath).toFile();
if (!file.exists()) {
throw new InvalidConfigurationException(
String.format("blobsArchivePath does not exist: '%s'", blobsArchivePath));
String.format("blobsArchivePath does not exist: '%s'", blobsArchivePath));
}
}
this.blobsArchivePath = blobsArchivePath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ public class BeaconNodeDataOptions extends ValidatorClientDataOptions {
private int blobsPruningLimit = StorageConfiguration.DEFAULT_BLOBS_PRUNING_LIMIT;

@CommandLine.Option(
names = {"--Xdata-storage-archive-path"},
hidden = true,
paramLabel = "<STRING>",
description = "Path to write pruned blobs",
fallbackValue = "true",
showDefaultValue = Visibility.ALWAYS,
arity = "0..1")
names = {"--Xdata-storage-archive-path"},
hidden = true,
paramLabel = "<STRING>",
description = "Path to write pruned blobs",
fallbackValue = "true",
showDefaultValue = Visibility.ALWAYS,
arity = "0..1")
private String blobsArchivePath = null;

@Option(
Expand Down

0 comments on commit 7cbfd4b

Please sign in to comment.