mirror of
https://github.com/DeBrosOfficial/network.git
synced 2026-01-30 03:43:04 +00:00
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.
This commit is contained in:
parent
fff665374f
commit
6f4f55f669
@ -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
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user