🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
// Code generated by ndpgen. DO NOT EDIT.
//
// This file contains mock implementations for non-WASM builds.
// These mocks allow IDE support, compilation, and unit testing on non-WASM platforms.
// Plugin authors can use the exported mock instances to set expectations in tests.
//
//go:build !wasip1
package host
import (
"github.com/stretchr/testify/mock"
)
// mockKVStoreService is the mock implementation for testing.
type mockKVStoreService struct {
mock.Mock
}
// KVStoreMock is the auto-instantiated mock instance for testing.
// Use this to set expectations: host.KVStoreMock.On("MethodName", args...).Return(values...)
var KVStoreMock = &mockKVStoreService{}
// Set is the mock method for KVStoreSet.
func (m *mockKVStoreService) Set(key string, value []byte) error {
args := m.Called(key, value)
return args.Error(0)
}
// KVStoreSet delegates to the mock instance.
// Set stores a byte value with the given key.
//
// Parameters:
// - key: The storage key (max 256 bytes, UTF-8)
// - value: The byte slice to store
//
// Returns an error if the storage limit would be exceeded or the operation fails.
func KVStoreSet(key string, value []byte) error {
return KVStoreMock.Set(key, value)
}
// SetWithTTL is the mock method for KVStoreSetWithTTL.
func (m *mockKVStoreService) SetWithTTL(key string, value []byte, ttlSeconds int64) error {
args := m.Called(key, value, ttlSeconds)
return args.Error(0)
}
// KVStoreSetWithTTL delegates to the mock instance.
// SetWithTTL stores a byte value with the given key and a time-to-live.
//
// After ttlSeconds, the key is treated as non-existent and will be
// cleaned up lazily. ttlSeconds must be greater than 0.
//
// Parameters:
// - key: The storage key (max 256 bytes, UTF-8)
// - value: The byte slice to store
// - ttlSeconds: Time-to-live in seconds (must be > 0)
//
// Returns an error if the storage limit would be exceeded or the operation fails.
func KVStoreSetWithTTL(key string, value []byte, ttlSeconds int64) error {
return KVStoreMock.SetWithTTL(key, value, ttlSeconds)
}
// Get is the mock method for KVStoreGet.
func (m *mockKVStoreService) Get(key string) ([]byte, bool, error) {
args := m.Called(key)
var r0 []byte
if v := args.Get(0); v != nil {
r0 = v.([]byte)
}
return r0, args.Bool(1), args.Error(2)
}
// KVStoreGet delegates to the mock instance.
// Get retrieves a byte value from storage.
//
// Parameters:
// - key: The storage key
//
// Returns the value and whether the key exists.
func KVStoreGet(key string) ([]byte, bool, error) {
return KVStoreMock.Get(key)
}
// GetMany is the mock method for KVStoreGetMany.
func (m *mockKVStoreService) GetMany(keys []string) (map[string][]byte, error) {
args := m.Called(keys)
var r0 map[string][]byte
if v := args.Get(0); v != nil {
r0 = v.(map[string][]byte)
}
return r0, args.Error(1)
}
// KVStoreGetMany delegates to the mock instance.
// GetMany retrieves multiple values in a single call.
//
// Parameters:
// - keys: The storage keys to retrieve
//
// Returns a map of key to value for keys that exist and have not expired.
// Missing or expired keys are omitted from the result.
func KVStoreGetMany(keys []string) (map[string][]byte, error) {
return KVStoreMock.GetMany(keys)
}
// Has is the mock method for KVStoreHas.
func (m *mockKVStoreService) Has(key string) (bool, error) {
args := m.Called(key)
return args.Bool(0), args.Error(1)
}
// KVStoreHas delegates to the mock instance.
// Has checks if a key exists in storage.
//
// Parameters:
// - key: The storage key
//
// Returns true if the key exists.
func KVStoreHas(key string) (bool, error) {
return KVStoreMock.Has(key)
}
// List is the mock method for KVStoreList.
func (m *mockKVStoreService) List(prefix string) ([]string, error) {
args := m.Called(prefix)
var r0 []string
if v := args.Get(0); v != nil {
r0 = v.([]string)
}
return r0, args.Error(1)
}
// KVStoreList delegates to the mock instance.
// List returns all keys matching the given prefix.
//
// Parameters:
// - prefix: Key prefix to filter by (empty string returns all keys)
//
// Returns a slice of matching keys.
func KVStoreList(prefix string) ([]string, error) {
return KVStoreMock.List(prefix)
}
// Delete is the mock method for KVStoreDelete.
func (m *mockKVStoreService) Delete(key string) error {
args := m.Called(key)
return args.Error(0)
}
// KVStoreDelete delegates to the mock instance.
// Delete removes a value from storage.
//
// Parameters:
// - key: The storage key
//
// Returns an error if the operation fails. Does not return an error if the key doesn't exist.
func KVStoreDelete(key string) error {
return KVStoreMock.Delete(key)
}
// DeleteByPrefix is the mock method for KVStoreDeleteByPrefix.
func (m *mockKVStoreService) DeleteByPrefix(prefix string) (int64, error) {
args := m.Called(prefix)
return args.Get(0).(int64), args.Error(1)
}
// KVStoreDeleteByPrefix delegates to the mock instance.
// DeleteByPrefix removes all keys matching the given prefix.
//
// Parameters:
// - prefix: Key prefix to match (must not be empty)
//
// Returns the number of keys deleted. Includes expired keys.
func KVStoreDeleteByPrefix(prefix string) (int64, error) {
return KVStoreMock.DeleteByPrefix(prefix)
}
// GetStorageUsed is the mock method for KVStoreGetStorageUsed.
func (m *mockKVStoreService) GetStorageUsed() (int64, error) {
args := m.Called()
return args.Get(0).(int64), args.Error(1)
}
// KVStoreGetStorageUsed delegates to the mock instance.
// GetStorageUsed returns the total storage used by this plugin in bytes.
func KVStoreGetStorageUsed() (int64, error) {
return KVStoreMock.GetStorageUsed()
}