From 387ef36c0fda9eb7d7fbccb34e263e9b7765a117 Mon Sep 17 00:00:00 2001 From: Salim Afiune Maya Date: Thu, 12 Dec 2024 15:33:30 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20move=20`inmemory/kiss.go`=20->?= =?UTF-8?q?=20`inmemory/store/kiss.go`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Salim Afiune Maya --- internal/datalakes/inmemory/inmemory.go | 5 +++-- internal/datalakes/inmemory/{ => store}/kiss.go | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) rename internal/datalakes/inmemory/{ => store}/kiss.go (90%) diff --git a/internal/datalakes/inmemory/inmemory.go b/internal/datalakes/inmemory/inmemory.go index 96edb91b8..beab737dc 100644 --- a/internal/datalakes/inmemory/inmemory.go +++ b/internal/datalakes/inmemory/inmemory.go @@ -8,12 +8,13 @@ import ( "github.com/google/uuid" "go.mondoo.com/cnquery/v11/explorer" + "go.mondoo.com/cnquery/v11/internal/datalakes/inmemory/store" "go.mondoo.com/cnquery/v11/llx" ) // Db is the database backend, it allows the interaction with the underlying data. type Db struct { - cache KVStore + cache store.KeyValue services *explorer.LocalServices // bidirectional connection between db + services uuid string // used for all object identifiers to prevent clashes (eg in-memory pubsub) nowProvider func() time.Time @@ -21,7 +22,7 @@ type Db struct { // NewServices creates a new set of backend services func NewServices(runtime llx.Runtime) (*Db, *explorer.LocalServices, error) { - var cache KVStore = NewKissDb() + var cache store.KeyValue = store.NewKissDb() db := &Db{ cache: cache, diff --git a/internal/datalakes/inmemory/kiss.go b/internal/datalakes/inmemory/store/kiss.go similarity index 90% rename from internal/datalakes/inmemory/kiss.go rename to internal/datalakes/inmemory/store/kiss.go index a4bbad350..e0be629e3 100644 --- a/internal/datalakes/inmemory/kiss.go +++ b/internal/datalakes/inmemory/store/kiss.go @@ -1,12 +1,12 @@ // Copyright (c) Mondoo, Inc. // SPDX-License-Identifier: BUSL-1.1 -package inmemory +package store import "sync" -// KVStore is an general-purpose abstraction for key-value stores -type KVStore interface { +// KeyValue is an general-purpose abstraction for key-value stores +type KeyValue interface { Get(key interface{}) (interface{}, bool) Set(key interface{}, value interface{}, cost int64) bool Del(key interface{})