Search in sources :

Example 1 with TableCommitMetaStoreWorker

use of org.projectnessie.server.store.TableCommitMetaStoreWorker in project nessie by projectnessie.

the class PersistVersionStoreExtension method afterBeanDiscovery.

@SuppressWarnings("unused")
public void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager bm) {
    TableCommitMetaStoreWorker storeWorker = new TableCommitMetaStoreWorker();
    abd.addBean().addType(new TypeLiteral<VersionStore<Content, CommitMeta, Type>>() {
    }).addQualifier(Default.Literal.INSTANCE).scope(ApplicationScoped.class).produceWith(i -> new PersistVersionStore<>(databaseAdapter.get(), storeWorker));
}
Also used : Type(org.projectnessie.model.Content.Type) TypeLiteral(javax.enterprise.util.TypeLiteral) TableCommitMetaStoreWorker(org.projectnessie.server.store.TableCommitMetaStoreWorker) Content(org.projectnessie.model.Content) CommitMeta(org.projectnessie.model.CommitMeta) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 2 with TableCommitMetaStoreWorker

use of org.projectnessie.server.store.TableCommitMetaStoreWorker in project nessie by projectnessie.

the class DatabaseAdapterProvider method produceDatabaseAdapter.

@Produces
@Singleton
@Startup
public DatabaseAdapter produceDatabaseAdapter() {
    VersionStoreType versionStoreType = storeConfig.getVersionStoreType();
    LOGGER.info("Using {} Version store", versionStoreType);
    TableCommitMetaStoreWorker storeWorker = new TableCommitMetaStoreWorker();
    DatabaseAdapter databaseAdapter = databaseAdapterBuilder.select(new Literal(versionStoreType)).get().newDatabaseAdapter(new GenericContentVariantSupplier<>(storeWorker));
    databaseAdapter.initializeRepo(serverConfig.getDefaultBranch());
    if (storeConfig.isTracingEnabled()) {
        databaseAdapter = new TracingDatabaseAdapter(databaseAdapter);
    }
    return databaseAdapter;
}
Also used : TracingDatabaseAdapter(org.projectnessie.versioned.persist.adapter.spi.TracingDatabaseAdapter) VersionStoreType(org.projectnessie.quarkus.config.VersionStoreConfig.VersionStoreType) TableCommitMetaStoreWorker(org.projectnessie.server.store.TableCommitMetaStoreWorker) Literal(org.projectnessie.quarkus.providers.StoreType.Literal) TracingDatabaseAdapter(org.projectnessie.versioned.persist.adapter.spi.TracingDatabaseAdapter) DatabaseAdapter(org.projectnessie.versioned.persist.adapter.DatabaseAdapter) Produces(javax.enterprise.inject.Produces) Singleton(javax.inject.Singleton) Startup(io.quarkus.runtime.Startup)

Example 3 with TableCommitMetaStoreWorker

use of org.projectnessie.server.store.TableCommitMetaStoreWorker in project nessie by projectnessie.

the class PersistVersionStoreExtension method afterBeanDiscovery.

@SuppressWarnings("unused")
public void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager bm) {
    TableCommitMetaStoreWorker storeWorker = new TableCommitMetaStoreWorker();
    abd.addBean().addType(new TypeLiteral<VersionStore<Content, CommitMeta, Type>>() {
    }).addQualifier(Default.Literal.INSTANCE).scope(ApplicationScoped.class).produceWith(i -> new PersistVersionStore<>(databaseAdapter.get(), storeWorker));
}
Also used : Type(org.projectnessie.model.Content.Type) TypeLiteral(javax.enterprise.util.TypeLiteral) TableCommitMetaStoreWorker(org.projectnessie.server.store.TableCommitMetaStoreWorker) Content(org.projectnessie.model.Content) CommitMeta(org.projectnessie.model.CommitMeta) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 4 with TableCommitMetaStoreWorker

use of org.projectnessie.server.store.TableCommitMetaStoreWorker 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;
    }
}
Also used : PersistVersionStore(org.projectnessie.versioned.persist.store.PersistVersionStore) VersionStoreType(org.projectnessie.quarkus.config.VersionStoreConfig.VersionStoreType) VersionStoreType(org.projectnessie.quarkus.config.VersionStoreConfig.VersionStoreType) TableCommitMetaStoreWorker(org.projectnessie.server.store.TableCommitMetaStoreWorker) IOError(java.io.IOError) Content(org.projectnessie.model.Content) CommitMeta(org.projectnessie.model.CommitMeta) Produces(javax.enterprise.inject.Produces) Singleton(javax.inject.Singleton) Startup(io.quarkus.runtime.Startup)

Aggregations

TableCommitMetaStoreWorker (org.projectnessie.server.store.TableCommitMetaStoreWorker)4 CommitMeta (org.projectnessie.model.CommitMeta)3 Content (org.projectnessie.model.Content)3 Startup (io.quarkus.runtime.Startup)2 ApplicationScoped (javax.enterprise.context.ApplicationScoped)2 Produces (javax.enterprise.inject.Produces)2 TypeLiteral (javax.enterprise.util.TypeLiteral)2 Singleton (javax.inject.Singleton)2 Type (org.projectnessie.model.Content.Type)2 VersionStoreType (org.projectnessie.quarkus.config.VersionStoreConfig.VersionStoreType)2 IOError (java.io.IOError)1 Literal (org.projectnessie.quarkus.providers.StoreType.Literal)1 DatabaseAdapter (org.projectnessie.versioned.persist.adapter.DatabaseAdapter)1 TracingDatabaseAdapter (org.projectnessie.versioned.persist.adapter.spi.TracingDatabaseAdapter)1 PersistVersionStore (org.projectnessie.versioned.persist.store.PersistVersionStore)1