use of org.projectnessie.versioned.persist.store.PersistVersionStore in project nessie by projectnessie.
the class ConfigurableVersionStoreFactory method getVersionStore.
/**
* Version store producer.
*/
@Produces
@Singleton
@Startup
public VersionStore<Content, CommitMeta, Content.Type> getVersionStore() {
VersionStoreType versionStoreType = storeConfig.getVersionStoreType();
try {
TableCommitMetaStoreWorker storeWorker = new TableCommitMetaStoreWorker();
VersionStore<Content, CommitMeta, Content.Type> versionStore = new PersistVersionStore<>(databaseAdapter, storeWorker);
if (storeConfig.isTracingEnabled()) {
versionStore = new TracingVersionStore<>(versionStore);
}
if (storeConfig.isMetricsEnabled()) {
versionStore = new MetricsVersionStore<>(versionStore);
}
return versionStore;
} catch (RuntimeException | IOError e) {
LOGGER.error("Failed to configure/start {} version store", versionStoreType, e);
throw e;
}
}
use of org.projectnessie.versioned.persist.store.PersistVersionStore in project nessie by projectnessie.
the class ErrorTestService method unhandledExceptionInTvsStore.
/**
* Throws an exception depending on the parameter.
*
* @return nothing
* @see TestNessieError#unhandledRuntimeExceptionInStore()
* @see TestNessieError#backendThrottledExceptionInStore()
*/
@Path("unhandledExceptionInTvsStore/{exception}")
@GET
@Consumes(MediaType.APPLICATION_JSON)
public String unhandledExceptionInTvsStore(@PathParam("exception") String exception) throws ReferenceNotFoundException {
Exception ex;
switch(exception) {
case "runtime":
ex = new RuntimeException("Store.getValues-throwing");
break;
case "throttle":
ex = new BackendLimitExceededException("Store.getValues-throttled");
break;
default:
throw new IllegalArgumentException("test code error");
}
DatabaseAdapter databaseAdapter = Mockito.mock(DatabaseAdapter.class);
Mockito.when(databaseAdapter.namedRefs(Mockito.any())).thenThrow(ex);
PersistVersionStore<BaseContent, CommitMessage, BaseContent.Type> tvs = new PersistVersionStore<>(databaseAdapter, SimpleStoreWorker.INSTANCE);
try (Stream<ReferenceInfo<CommitMessage>> refs = tvs.getNamedRefs(GetNamedRefsParams.DEFAULT)) {
refs.forEach(ref -> {
});
}
return "we should not get here";
}
Aggregations