Skip to content

Commit

Permalink
Moved connection to its own module
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaro committed Jul 28, 2024
1 parent 2aa6ee3 commit 0af2442
Show file tree
Hide file tree
Showing 22 changed files with 82 additions and 5 deletions.
68 changes: 68 additions & 0 deletions vitrivr-engine-module-jsonl/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
plugins {
id 'org.jetbrains.kotlin.plugin.serialization' version "$version_kotlin"
id 'maven-publish'
id 'signing'
}

repositories {
mavenCentral()
}

dependencies {
api project(':vitrivr-engine-core')

/** vitrivr engine Core is required for running tests. */
testImplementation(testFixtures(project(':vitrivr-engine-core')))
}

/* Publication of vitrivr engine query to Maven Central. */
publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'org.vitrivr'
artifactId = 'vitrivr-engine-module-jsonl'
version = System.getenv().getOrDefault("MAVEN_PUBLICATION_VERSION", version.toString())
from components.java
pom {
name = 'vitrivr Engine JSONL Connection Plugin'
description = 'A module that adds a file-based pseudo database using line-wise JSON.'
url = 'https://github.com/vitrivr/vitrivr-engine/'
licenses {
license {
name = 'MIT License'
}
}
developers {
developer {
id = 'ppanopticon'
name = 'Ralph Gasser'
email = '[email protected]'
}
developer {
id = 'lucaro'
name = 'Luca Rossetto'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:https://github.com/vitrivr/vitrivr-engine.git'
url = 'https://github.com/vitrivr/vitrivr-engine/'
}
}
}
}
repositories {
repositories {
maven {
def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
name = "OSSRH"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ import org.vitrivr.engine.core.model.metamodel.Schema

abstract class AbstractJsonlProvider<D : Descriptor> : DescriptorProvider<D> {

override fun newInitializer(connection: Connection, field: Schema.Field<*, D>): DescriptorInitializer<D> = JsonlInitializer(field, connection as JsonlConnection)
override fun newInitializer(connection: Connection, field: Schema.Field<*, D>): DescriptorInitializer<D> =
JsonlInitializer(
field,
connection as JsonlConnection
)

override fun newWriter(connection: Connection, field: Schema.Field<*, D>): DescriptorWriter<D> = JsonlWriter(field, connection as JsonlConnection)
override fun newWriter(connection: Connection, field: Schema.Field<*, D>): DescriptorWriter<D> =
JsonlWriter(
field,
connection as JsonlConnection
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ import org.vitrivr.engine.database.jsonl.model.JsonlRelationship
import org.vitrivr.engine.database.jsonl.model.JsonlRetrievable
import java.io.File
import java.io.FileWriter
import java.nio.file.StandardOpenOption
import kotlin.io.path.writer

class JsonlRetrievableWriter(override val connection: JsonlConnection) : RetrievableWriter, AutoCloseable {

private val retrievableWriter = FileWriter(File(connection.schemaRoot, "retrievables.jsonl"), true)
private val connectionWriter = FileWriter(File(connection.schemaRoot, "retrievable_connections.jsonl"), true)
private val retrievableWriter = connection.schemaRoot.resolve("retrievables.jsonl").writer(Charsets.UTF_8, StandardOpenOption.APPEND)
private val connectionWriter = connection.schemaRoot.resolve("retrievable_connections.jsonl").writer(Charsets.UTF_8, StandardOpenOption.APPEND)

@Synchronized
override fun connect(relationship: Relationship): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package org.vitrivr.engine.database.jsonl.struct
import org.vitrivr.engine.core.database.Connection
import org.vitrivr.engine.core.database.descriptor.DescriptorReader
import org.vitrivr.engine.core.model.descriptor.struct.StructDescriptor
import org.vitrivr.engine.core.model.descriptor.vector.VectorDescriptor
import org.vitrivr.engine.core.model.metamodel.Schema
import org.vitrivr.engine.database.jsonl.AbstractJsonlProvider
import org.vitrivr.engine.database.jsonl.JsonlConnection
Expand Down

0 comments on commit 0af2442

Please sign in to comment.