Skip to content

Commit

Permalink
use base Dereferencer interface when possible;
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorrit Poelen committed Jan 14, 2025
1 parent 35e909b commit 1781296
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import bio.guoda.preston.HashGenerator;
import bio.guoda.preston.process.StatementsListenerAdapter;
import bio.guoda.preston.store.BlobStoreReadOnly;
import bio.guoda.preston.store.Dereferencer;
import bio.guoda.preston.store.HashKeyUtil;
import bio.guoda.preston.store.KeyToPath;
Expand All @@ -29,14 +28,14 @@

public class HashVerifier extends StatementsListenerAdapter {
private final Map<String, VerificationState> verifiedMap;
private final BlobStoreReadOnly blobStore;
private final Dereferencer<InputStream> blobStore;
private final HashGenerator<IRI> hashGenerator;
private final boolean skipHashVerification;
private final KeyToPath keyToPath;
private final OutputStream outputStream;

public HashVerifier(Map<String, VerificationState> verifiedMap,
BlobStoreReadOnly blobStore,
Dereferencer<InputStream> blobStore,
HashGenerator<IRI> hashGenerator,
boolean skipHashVerification,
OutputStream outputStream,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
package bio.guoda.preston.cmd;

import bio.guoda.preston.IRIFixingProcessor;
import bio.guoda.preston.process.EmittingStreamFactory;
import bio.guoda.preston.process.ProcessorState;
import bio.guoda.preston.process.ProcessorStateAlwaysContinue;
import bio.guoda.preston.process.StatementIRIProcessor;
import bio.guoda.preston.process.StatementsListener;
import bio.guoda.preston.process.StatementsListenerAdapter;
import bio.guoda.preston.store.ArchiverReadOnly;
import bio.guoda.preston.store.BlobStoreAppendOnly;
import bio.guoda.preston.store.BlobStoreReadOnly;
import bio.guoda.preston.IRIFixingProcessor;
import bio.guoda.preston.store.Dereferencer;
import bio.guoda.preston.store.ProvenanceTracer;
import bio.guoda.preston.process.StatementIRIProcessor;
import bio.guoda.preston.store.ValidatingKeyValueStreamContentAddressedFactory;
import bio.guoda.preston.store.VersionedRDFChainEmitter;
import org.apache.commons.rdf.api.IRI;
import org.apache.commons.rdf.api.Quad;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -47,7 +49,7 @@ static void attemptReplay(final BlobStoreReadOnly provenanceLogStore,
);
}

static void attemptReplay(final BlobStoreReadOnly provenanceLogStore,
static void attemptReplay(final Dereferencer<InputStream> provenanceLogStore,
final CmdContext ctx,
ProvenanceTracer provenanceTracer,
EmittingStreamFactory emitterFactory) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package bio.guoda.preston.process;

import bio.guoda.preston.store.Dereferencer;
import bio.guoda.preston.store.KeyValueStoreReadOnly;
import bio.guoda.preston.store.StatementProcessor;
import org.apache.commons.rdf.api.IRI;
Expand All @@ -10,12 +11,12 @@

public abstract class ProcessorReadOnly extends StatementProcessor implements KeyValueStoreReadOnly {

private final KeyValueStoreReadOnly blobStoreReadOnly;
private final Dereferencer<InputStream> blobStoreReadOnly;

public ProcessorReadOnly(KeyValueStoreReadOnly blobStoreReadOnly, StatementsListener... listeners) {
public ProcessorReadOnly(Dereferencer<InputStream> blobStoreReadOnly, StatementsListener... listeners) {
this(blobStoreReadOnly, new ProcessorStateAlwaysContinue(), listeners);
}
public ProcessorReadOnly(KeyValueStoreReadOnly blobStoreReadOnly, ProcessorState state, StatementsListener... listeners) {
public ProcessorReadOnly(Dereferencer<InputStream> blobStoreReadOnly, ProcessorState state, StatementsListener... listeners) {
super(state, listeners);
Objects.requireNonNull(blobStoreReadOnly);
this.blobStoreReadOnly = blobStoreReadOnly;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ public class VersionedRDFChainEmitter extends ProcessorReadOnly {
private static final Logger LOG = LoggerFactory.getLogger(VersionedRDFChainEmitter.class);
private final EmittingStreamFactory emitterFactory;

public VersionedRDFChainEmitter(BlobStoreReadOnly blobStoreReadOnly,
public VersionedRDFChainEmitter(Dereferencer<InputStream> blobStoreReadOnly,
EmittingStreamFactory emitterFactory,
StatementsListener... listeners) {
super(blobStoreReadOnly, listeners);
this.emitterFactory = emitterFactory;
}

public VersionedRDFChainEmitter(BlobStoreReadOnly blobStoreReadOnly,
public VersionedRDFChainEmitter(Dereferencer<InputStream> blobStoreReadOnly,
ProcessorState state,
EmittingStreamFactory emitterFactory,
StatementsListener... listeners) {
Expand Down

0 comments on commit 1781296

Please sign in to comment.