Skip to content

Commit

Permalink
Add NoOpCollectionStore
Browse files Browse the repository at this point in the history
Summary:

Test Plan:
  • Loading branch information
imdominicreed committed Nov 20, 2024
1 parent e78dbdb commit 62761f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sdk/src/main/java/io/opentdf/platform/sdk/NanoTDF.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class NanoTDF {
private final CollectionStore collectionStore;

public NanoTDF() {
this(null);
this(new CollectionStore.NoOpCollectionStore());
}

public NanoTDF(boolean collectionStoreEnabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@
import io.opentdf.platform.sdk.NanoTDF;

public interface CollectionStore {
public static final NanoTDF.CollectionKey NO_PRIVATE_KEY = new NanoTDF.CollectionKey(null);
NanoTDF.CollectionKey NO_PRIVATE_KEY = new NanoTDF.CollectionKey(null);
void store(Header header, NanoTDF.CollectionKey key);
NanoTDF.CollectionKey getKey(Header header);

class NoOpCollectionStore implements CollectionStore {
public NoOpCollectionStore() {}

@Override
public void store(Header header, NanoTDF.CollectionKey key) {}

@Override
public NanoTDF.CollectionKey getKey(Header header) {
return NO_PRIVATE_KEY;
}
}
}

0 comments on commit 62761f9

Please sign in to comment.