Skip to content

Commit

Permalink
Merge pull request #114 from upserve/add_profile_name_to_store_builder
Browse files Browse the repository at this point in the history
Add a profile string to the AppendOnlyStoreBuilder
  • Loading branch information
ls-nicholas-nassar authored May 25, 2021
2 parents eedf4a1 + 7389a6f commit 1ef7f9d
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/main/java/com/upserve/uppend/AppendOnlyStoreBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,35 @@ public AppendOnlyStoreBuilder withCacheBuffers(boolean cacheBuffers) {
}

public AppendOnlyStore build() {
return build(false);
return build(false, null);
}

public AppendOnlyStore build(boolean readOnly) {

/**
* Constructs the store
*
* @param readOnly make the store readonly?
* @param storeProfile Identifier to use for metrics. This should be unique to the server instance to avoid
* name collisions when registering metrics
* @return the new store
*/
public AppendOnlyStore build(boolean readOnly, String storeProfile) {
String rootName = getMetricsRootName();
if (null != storeProfile) {
rootName = rootName+ "." + storeProfile;
}
if (readOnly) rootName = rootName + ".readonly";
AppendOnlyStore store = new FileAppendOnlyStore(readOnly, this);
if (isStoreMetrics()) store = new AppendOnlyStoreWithMetrics(store, getStoreMetricsRegistry(), getMetricsRootName());
if (isStoreMetrics()) store = new AppendOnlyStoreWithMetrics(store, getStoreMetricsRegistry(), rootName);
return store;
}

public AppendOnlyStore build(boolean readOnly) {
return build(readOnly, null);
}

public ReadOnlyAppendOnlyStore buildReadOnly() {
return build(true);
return build(true, null);
}

public int getBlobsPerBlock() {
Expand Down

0 comments on commit 1ef7f9d

Please sign in to comment.