Documentation
¶
Index ¶
- type AllBlocksCleared
- type BlockRemoved
- type BlockStored
- type ContextData
- type EngineHashMapping
- type ModelContext
- type PodInfo
- type PrefixStore
- type SyncPrefixHashTable
- func (s *SyncPrefixHashTable) AddPrefix(modelName string, loraID int64, podName string, prefixHashes []uint64) error
- func (s *SyncPrefixHashTable) Close()
- func (s *SyncPrefixHashTable) GetPrefixHashes(tokens []byte) []uint64
- func (s *SyncPrefixHashTable) MatchPrefix(modelName string, loraID int64, tokens []byte, readyPods map[string]struct{}) (map[string]int, []uint64)
- func (s *SyncPrefixHashTable) ProcessAllBlocksCleared(event AllBlocksCleared) error
- func (s *SyncPrefixHashTable) ProcessBlockRemoved(event BlockRemoved) error
- func (s *SyncPrefixHashTable) ProcessBlockStored(event BlockStored) error
- func (s *SyncPrefixHashTable) RemovePrefix(modelName string, loraID int64, podName string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllBlocksCleared ¶
type AllBlocksCleared struct {
}
AllBlocksCleared represents an event when all blocks are cleared This is currently not implemented as per requirements
type BlockRemoved ¶
type BlockRemoved struct {
// BlockHashes contains the engine block hashes that were removed
BlockHashes []int64
// Context information
ModelName string
LoraID int64 // -1 for no adapter
// Source pod that removed these blocks (optional)
SourcePod string
}
BlockRemoved represents an event when blocks are removed
type BlockStored ¶
type BlockStored struct {
// BlockHashes contains the engine block hashes that were stored
BlockHashes []int64
// ParentBlockHash is the optional parent block hash
// nil means this is the first block in the sequence
ParentBlockHash *int64
// Tokens contains the token data for each block
// The length should match BlockHashes
Tokens [][]byte
// Context information
ModelName string
LoraID int64 // -1 for no adapter
// Source pod that stored these blocks
SourcePod string
}
BlockStored represents an event when blocks are stored
type ContextData ¶
type ContextData struct {
// contains filtered or unexported fields
}
ContextData holds all data for a specific context with separate locks
type EngineHashMapping ¶
type EngineHashMapping struct {
// contains filtered or unexported fields
}
EngineHashMapping maintains unidirectional mapping
type ModelContext ¶
ModelContext represents the first-level hash key
type PodInfo ¶
type PodInfo struct {
LastAccessTime atomic.Int64 // Unix timestamp (lock-free update)
SourcePod string
}
PodInfo stores pod access information
type PrefixStore ¶
type PrefixStore struct {
// contains filtered or unexported fields
}
PrefixStore manages prefix hashes for a specific (model, lora_id) context
type SyncPrefixHashTable ¶
type SyncPrefixHashTable struct {
// contains filtered or unexported fields
}
SyncPrefixHashTable is the main structure
func GetSharedSyncPrefixHashTable ¶ added in v0.7.0
func GetSharedSyncPrefixHashTable() *SyncPrefixHashTable
GetSharedSyncPrefixHashTable returns the shared singleton instance of SyncPrefixHashTable. This ensures that all components (Store, kvSyncRouter, etc.) use the same indexer instance. This follows the same pattern as GetSharedPrefixHashTable for consistency.
func NewSyncPrefixHashTable ¶
func NewSyncPrefixHashTable() *SyncPrefixHashTable
NewSyncPrefixHashTable creates a new sync prefix hash table
func (*SyncPrefixHashTable) AddPrefix ¶
func (s *SyncPrefixHashTable) AddPrefix(modelName string, loraID int64, podName string, prefixHashes []uint64) error
AddPrefix adds prefix hashes for a specific model/lora context and pod
func (*SyncPrefixHashTable) Close ¶
func (s *SyncPrefixHashTable) Close()
Close stops the eviction worker and cleans up resources
func (*SyncPrefixHashTable) GetPrefixHashes ¶
func (s *SyncPrefixHashTable) GetPrefixHashes(tokens []byte) []uint64
GetPrefixHashes computes prefix hashes for given tokens
func (*SyncPrefixHashTable) MatchPrefix ¶
func (s *SyncPrefixHashTable) MatchPrefix(modelName string, loraID int64, tokens []byte, readyPods map[string]struct{}) (map[string]int, []uint64)
MatchPrefix matches the input token prefix if already cached returns map[podname]%prefixmatch along with all prefix hashes
func (*SyncPrefixHashTable) ProcessAllBlocksCleared ¶
func (s *SyncPrefixHashTable) ProcessAllBlocksCleared(event AllBlocksCleared) error
ProcessAllBlocksCleared handles AllBlocksCleared events (placeholder implementation)
func (*SyncPrefixHashTable) ProcessBlockRemoved ¶
func (s *SyncPrefixHashTable) ProcessBlockRemoved(event BlockRemoved) error
ProcessBlockRemoved handles BlockRemoved events
func (*SyncPrefixHashTable) ProcessBlockStored ¶
func (s *SyncPrefixHashTable) ProcessBlockStored(event BlockStored) error
ProcessBlockStored handles BlockStored events
func (*SyncPrefixHashTable) RemovePrefix ¶
func (s *SyncPrefixHashTable) RemovePrefix(modelName string, loraID int64, podName string) error
RemovePrefix removes a specific pod from all prefix entries