Skip to content

Commit

Permalink
m5l5 - Графовая БД
Browse files Browse the repository at this point in the history
  • Loading branch information
svok committed Dec 28, 2023
1 parent 3052ea3 commit 7a2e536
Show file tree
Hide file tree
Showing 20 changed files with 805 additions and 4 deletions.
34 changes: 34 additions & 0 deletions deploy/docker-compose-ktor-gremlin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: '3'
services:
gremlin:
# image: "arcadedata/arcadedb:23.4.1"
image: "arcadedata/arcadedb:23.7.1"
container_name: gremlin
ports:
- "2480:2480"
- "2424:2424"
- "8182:8182"
volumes:
- gremlin_data:/home/arcadedb/databases
environment:
JAVA_OPTS: "-Darcadedb.server.rootPassword=root_root -Darcadedb.server.plugins=GremlinServer:com.arcadedb.server.gremlin.GremlinServerPlugin -Darcadedb.server.defaultDatabases=mkpl[root1:playwithdata]"

# app:
# image: "ok-marketplace-app-ktor:0.0.3"
# container_name: app-ktor
# ports:
# - "8080:8080"
## expose:
## - "8080"
# environment:
# DB_TYPE_PROD: gremlin
# DB_GREMLIN_HOST: gremlin
# DB_GREMLIN_PORT: 8182
# DB_GREMLIN_USER: root
# DB_GREMLIN_PASS: root_root
# depends_on:
# - gremlin

volumes:
gremlin_data:

6 changes: 5 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,8 @@ exposedVersion=0.41.1
kafkaVersion=3.4.0

# Cassandra
cassandraDriverVersion=4.13.0
cassandraDriverVersion=4.13.0

# Gremlin
tinkerpopVersion=3.7.0
arcadeDbVersion=23.7.1
7 changes: 7 additions & 0 deletions ok-marketplace-repo-gremlin/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Модуль `ok-marketplace-repo-gremlin`


Модуль реализует интерфейс репозитория ArcadeDb с вариантом Apache TinkerPop Gremlin.

Поддерживается только JVM платформа.

59 changes: 59 additions & 0 deletions ok-marketplace-repo-gremlin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import org.jetbrains.kotlin.gradle.internal.ensureParentDirsCreated

plugins {
kotlin("jvm")
}

val generatedPath = "$buildDir/generated/main/kotlin"
sourceSets {
main {
java.srcDir(generatedPath)
}
}

dependencies {
val arcadeDbVersion: String by project
val tinkerpopVersion: String by project
val coroutinesVersion: String by project
val kmpUUIDVersion: String by project
val testContainersVersion: String by project

implementation(project(":ok-marketplace-common"))

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
implementation("com.benasher44:uuid:$kmpUUIDVersion")

testImplementation(project(":ok-marketplace-repo-tests"))

implementation(kotlin("stdlib-jdk8"))
implementation("org.apache.tinkerpop:gremlin-driver:$tinkerpopVersion")
// constraints {
// implementation("commons-collections:commons-collections:3.2.2") {
// because("Uncontrolled Recursion vulnerability pending CVSS allocation")
// }
// }
implementation("com.arcadedb:arcadedb-engine:$arcadeDbVersion")
implementation("com.arcadedb:arcadedb-network:$arcadeDbVersion")
implementation("com.arcadedb:arcadedb-gremlin:$arcadeDbVersion")

testImplementation(kotlin("test-junit"))
testImplementation("org.testcontainers:testcontainers:$testContainersVersion")
}

val arcadeDbVersion: String by project

tasks {
val gradleConstants by creating {
file("$generatedPath/GradleConstants.kt").apply {
ensureParentDirsCreated()
writeText(
"""
package ru.otus.otuskotlin.marketplace.backend.repository.gremlin
const val ARCADEDB_VERSION = "$arcadeDbVersion"
""".trimIndent()
)
}
}
compileKotlin.get().dependsOn(gradleConstants)
}
16 changes: 16 additions & 0 deletions ok-marketplace-repo-gremlin/src/main/kotlin/AdGremlinConst.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package ru.otus.otuskotlin.marketplace.backend.repository.gremlin

object AdGremlinConst {
const val RESULT_SUCCESS = "success"
const val RESULT_LOCK_FAILURE = "lock-failure"

const val FIELD_ID = "#id"
const val FIELD_TITLE = "title"
const val FIELD_DESCRIPTION = "description"
const val FIELD_AD_TYPE = "adType"
const val FIELD_OWNER_ID = "ownerId"
const val FIELD_VISIBILITY = "visibility"
const val FIELD_PRODUCT_ID = "productId"
const val FIELD_LOCK = "lock"
const val FIELD_TMP_RESULT = "_result"
}
Loading

0 comments on commit 7a2e536

Please sign in to comment.