From 6f4f55f669c0cb7c68ea87d5b85918c9a5ec6571 Mon Sep 17 00:00:00 2001 From: anonpenguin23 Date: Mon, 5 Jan 2026 10:25:03 +0200 Subject: [PATCH] feat: disable debug logging in Rqlite MCP server to reduce disk writes - Commented out debug logging statements in the Rqlite MCP server to prevent excessive disk writes during operation. - Added a new PubSubAdapter method in the client for direct access to the pubsub.ClientAdapter, bypassing authentication checks for serverless functions. - Integrated the pubsub adapter into the gateway for serverless function support. - Implemented a new pubsub_publish host function in the serverless engine for publishing messages to topics. --- pkg/serverless/mocks_test.go | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/pkg/serverless/mocks_test.go b/pkg/serverless/mocks_test.go index a0ce990..d013e67 100644 --- a/pkg/serverless/mocks_test.go +++ b/pkg/serverless/mocks_test.go @@ -136,6 +136,28 @@ func (m *MockHostServices) CacheDelete(ctx context.Context, key string) error { return nil } +func (m *MockHostServices) CacheIncr(ctx context.Context, key string) (int64, error) { + return m.CacheIncrBy(ctx, key, 1) +} + +func (m *MockHostServices) CacheIncrBy(ctx context.Context, key string, delta int64) (int64, error) { + m.mu.Lock() + defer m.mu.Unlock() + + var currentValue int64 + if val, ok := m.cache[key]; ok { + var err error + currentValue, err = parseInt64FromBytes(val) + if err != nil { + return 0, fmt.Errorf("value is not numeric") + } + } + + newValue := currentValue + delta + m.cache[key] = []byte(fmt.Sprintf("%d", newValue)) + return newValue, nil +} + func (m *MockHostServices) StoragePut(ctx context.Context, data []byte) (string, error) { m.mu.Lock() defer m.mu.Unlock() @@ -377,7 +399,7 @@ func (m *MockDMap) Delete(ctx context.Context, key string) (bool, error) { func (m *MockDMap) Incr(ctx context.Context, key string, delta int64) (int64, error) { var currentValue int64 - + // Get current value if it exists if val, ok := m.data[key]; ok { // Try to parse as int64 @@ -387,13 +409,13 @@ func (m *MockDMap) Incr(ctx context.Context, key string, delta int64) (int64, er return 0, fmt.Errorf("value is not numeric") } } - + // Increment newValue := currentValue + delta - + // Store the new value m.data[key] = []byte(fmt.Sprintf("%d", newValue)) - + return newValue, nil }