| 89 | type StableSequenceCallbackFunc func() uint64 |
| 90 | |
| 91 | type channelCacheImpl struct { |
| 92 | queryHandlerFactory ChannelQueryHandlerFactory // Factory to look up ChannelQueryHandler for a collectionID |
| 93 | channelCaches *channels.RangeSafeCollection // A collection of singleChannelCaches |
| 94 | backgroundTasks []BackgroundTask // List of background tasks specific to channel cache. |
| 95 | dbName string // Name of the database associated with the channel cache. |
| 96 | terminator chan bool // Signal terminator of background goroutines |
| 97 | options ChannelCacheOptions // Channel cache options |
| 98 | lateSeqLock sync.RWMutex // Coordinates access to late sequence caches |
| 99 | highCacheSequence uint64 // The highest sequence that has been cached. Used to initialize validFrom for new singleChannelCaches |
| 100 | seqLock sync.RWMutex // Mutex for highCacheSequence |
| 101 | maxChannels int // Maximum number of channels in the cache |
| 102 | compactHighWatermark int // High Watermark for cache compaction |
| 103 | compactLowWatermark int // Low Watermark for cache compaction |
| 104 | compactRunning base.AtomicBool // Whether compact is currently running |
| 105 | activeChannels *channels.ActiveChannels // Active channel handler |
| 106 | cacheStats *base.CacheStats // Map used for cache stats |
| 107 | validFromLock sync.RWMutex // Mutex used to avoid race between AddToCache and addChannelCache. See CBG-520 for more details |
| 108 | } |
| 109 | |
| 110 | func NewChannelCacheForContext(ctx context.Context, options ChannelCacheOptions, context *DatabaseContext) (*channelCacheImpl, error) { |
| 111 | return newChannelCache(ctx, context.Name, options, context.getQueryHandlerForCollection, context.activeChannels, context.DbStats.Cache()) |
nothing calls this directly
no outgoing calls
no test coverage detected