| 101 | } |
| 102 | |
| 103 | type singleChannelCacheImpl struct { |
| 104 | channelID channels.ID // The channel |
| 105 | queryHandler ChannelQueryHandler // Channel query function |
| 106 | logs LogEntries // Log entries in sequence order |
| 107 | validFrom uint64 // First sequence that logs is valid for, not necessarily the seq number of a change entry. |
| 108 | lock sync.RWMutex // Controls access to logs, validFrom |
| 109 | queryLock sync.Mutex // Ensures only one view query is made at a time |
| 110 | lateLogs []*lateLogEntry // Late arriving LogEntries, stored in the order they were received |
| 111 | lastLateSequence uint64 // Used for fast check of whether listener has the latest |
| 112 | lateLogLock sync.RWMutex // Controls access to lateLogs |
| 113 | lateSequenceUUID uuid.UUID // UUID for late sequence consistency across cache compaction |
| 114 | options *ChannelCacheOptions // Cache size/expiry settings |
| 115 | cachedDocIDs map[string]struct{} // Set of keys present in the cache. Used for efficient check for previous revisions on append |
| 116 | recentlyUsed base.AtomicBool // Atomic recently used flag, used by cache compaction. |
| 117 | cacheStats *base.CacheStats // Map used for cache stats |
| 118 | } |
| 119 | |
| 120 | func newSingleChannelCache(queryHandler ChannelQueryHandler, channel channels.ID, validFrom uint64, cacheStats *base.CacheStats) *singleChannelCacheImpl { |
| 121 | cache := &singleChannelCacheImpl{queryHandler: queryHandler, channelID: channel, validFrom: validFrom} |
nothing calls this directly
no outgoing calls
no test coverage detected