@@ -13,111 +13,135 @@ import (
1313 "time"
1414)
1515
16- // test helpers
16+ // test helpers only for internal use only.
1717
18+ // TestEnsureCache is only exported for integration tests, not for general use.
1819func TestEnsureCache (ctx context.Context , session * Session , cache string ) (* int32 , error ) {
1920 return session .v1StreamManagerCache .ensureCache (ctx , cache )
2021}
2122
23+ // TestClearCache is only exported for integration tests, not for general use.
2224func TestClearCache (ctx context.Context , session * Session , cache string ) error {
2325 return session .v1StreamManagerCache .clearCache (ctx , cache )
2426}
2527
28+ // TestRemoveMapping is only exported for integration tests, not for general use.
2629func TestRemoveMapping (ctx context.Context , session * Session , cache string , key []byte , value []byte ) (bool , error ) {
2730 return session .v1StreamManagerCache .removeMapping (ctx , cache , key , value )
2831}
2932
33+ // TestReplaceMapping is only exported for integration tests, not for general use.
3034func TestReplaceMapping (ctx context.Context , session * Session , cache string , key []byte , prevValue []byte , newValue []byte ) (bool , error ) {
3135 return session .v1StreamManagerCache .replaceMapping (ctx , cache , key , prevValue , newValue )
3236}
3337
38+ // TestReplace is only exported for integration tests, not for general use.
3439func TestReplace (ctx context.Context , session * Session , cache string , key []byte , value []byte ) (* []byte , error ) {
3540 return session .v1StreamManagerCache .replace (ctx , cache , key , value )
3641}
3742
43+ // TestTruncateCache is only exported for integration tests, not for general use.
3844func TestTruncateCache (ctx context.Context , session * Session , cache string ) error {
3945 return session .v1StreamManagerCache .truncateCache (ctx , cache )
4046}
4147
48+ // TestDestroyCache is only exported for integration tests, not for general use.
4249func TestDestroyCache (ctx context.Context , session * Session , cache string ) error {
4350 return session .v1StreamManagerCache .destroyCache (ctx , cache )
4451}
4552
53+ // TestSize is only exported for integration tests, not for general use.
4654func TestSize (ctx context.Context , session * Session , cache string ) (int32 , error ) {
4755 return session .v1StreamManagerCache .size (ctx , cache )
4856}
4957
58+ // TestIsEmpty is only exported for integration tests, not for general use.
5059func TestIsEmpty (ctx context.Context , session * Session , cache string ) (bool , error ) {
5160 return session .v1StreamManagerCache .isEmpty (ctx , cache )
5261}
5362
63+ // TestIsReady is only exported for integration tests, not for general use.
5464func TestIsReady (ctx context.Context , session * Session , cache string ) (bool , error ) {
5565 return session .v1StreamManagerCache .isReady (ctx , cache )
5666}
5767
68+ // TestContainsKey is only exported for integration tests, not for general use.
5869func TestContainsKey (ctx context.Context , session * Session , cache string , key []byte ) (bool , error ) {
5970 return session .v1StreamManagerCache .containsKey (ctx , cache , key )
6071}
6172
73+ // TestContainsValue is only exported for integration tests, not for general use.
6274func TestContainsValue (ctx context.Context , session * Session , cache string , value []byte ) (bool , error ) {
6375 return session .v1StreamManagerCache .containsValue (ctx , cache , value )
6476}
6577
78+ // TestContainsEntry is only exported for integration tests, not for general use.
6679func TestContainsEntry (ctx context.Context , session * Session , cache string , key []byte , value []byte ) (bool , error ) {
6780 return session .v1StreamManagerCache .containsEntry (ctx , cache , key , value )
6881}
6982
83+ // TestGet is only exported for integration tests, not for general use.
7084func TestGet (ctx context.Context , session * Session , cache string , key []byte ) (* []byte , error ) {
7185 return session .v1StreamManagerCache .get (ctx , cache , key )
7286}
7387
88+ // TestGetAll is only exported for integration tests, not for general use.
7489func TestGetAll (ctx context.Context , session * Session , cache string , keys [][]byte ) (<- chan BinaryKeyAndValue , error ) {
7590 return session .v1StreamManagerCache .getAll (ctx , cache , keys )
7691}
7792
93+ // TestKeyAndValuePage is only exported for integration tests, not for general use.
7894func TestKeyAndValuePage (ctx context.Context , session * Session , cache string , cookie []byte ) (<- chan BinaryKeyAndValue , error ) {
7995 return session .v1StreamManagerCache .keyAndValuePage (ctx , cache , cookie )
8096}
8197
98+ // TestPut is only exported for integration tests, not for general use.
8299func TestPut (ctx context.Context , session * Session , cache string , key []byte , value []byte , ttl time.Duration ) (* []byte , error ) {
83100 return session .v1StreamManagerCache .put (ctx , cache , key , value , ttl )
84101}
85102
103+ // TestPutAll is only exported for integration tests, not for general use.
86104func TestPutAll (ctx context.Context , session * Session , cache string , entries []* pb1.BinaryKeyAndValue , ttl time.Duration ) error {
87105 return session .v1StreamManagerCache .putAll (ctx , cache , entries , ttl )
88106}
89107
108+ // TestRemove is only exported for integration tests, not for general use.
90109func TestRemove (ctx context.Context , session * Session , cache string , key []byte ) (* []byte , error ) {
91110 return session .v1StreamManagerCache .remove (ctx , cache , key )
92111}
93112
113+ // TestPutIfAbsent is only exported for integration tests, not for general use.
94114func TestPutIfAbsent (ctx context.Context , session * Session , cache string , key []byte , value []byte ) (* []byte , error ) {
95115 return session .v1StreamManagerCache .putIfAbsent (ctx , cache , key , value )
96116}
97117
118+ // TestAggregate is only exported for integration tests, not for general use.
98119func TestAggregate (ctx context.Context , session * Session , cache string , agent []byte , keysOrFilter * pb1.KeysOrFilter ) (* []byte , error ) {
99120 return session .v1StreamManagerCache .aggregate (ctx , cache , agent , keysOrFilter )
100121}
101122
123+ // TestInvoke is only exported for integration tests, not for general use.
102124func TestInvoke (ctx context.Context , session * Session , cache string , agent []byte , keysOrFilter * pb1.KeysOrFilter ) (<- chan BinaryKeyAndValue , error ) {
103125 return session .v1StreamManagerCache .invoke (ctx , cache , agent , keysOrFilter )
104126}
105127
128+ // TestMapListenerRequest is only exported for integration tests, not for general use.
106129func TestMapListenerRequest (ctx context.Context , session * Session , cache string , subscribe bool , keyOrFilter * pb1.KeyOrFilter ,
107130 lite bool , synchronous bool , priming bool , filterID int64 ) error {
108131 return session .v1StreamManagerCache .mapListenerRequest (ctx , cache , subscribe , keyOrFilter , lite , synchronous , priming , filterID )
109132}
110133
111- // GetSessionCacheID returns the cache id for a cache name
134+ // GetSessionCacheID is only exported for integration tests, not for general use.
112135func GetSessionCacheID (session * Session , cache string ) * int32 {
113136 return session .getCacheID (cache )
114137}
115138
116- // GetSessionQueueID returns the queue id for a cache name
139+ // GetSessionQueueID is only exported for integration tests, not for general use.
117140func GetSessionQueueID (session * Session , queue string ) * int32 {
118141 return session .getQueueID (queue )
119142}
120143
144+ // GetNearCachePruneFactor is only exported for integration tests, not for general use.
121145func GetNearCachePruneFactor [K comparable , V any ](namedMap NamedMap [K , V ]) float32 {
122146 ncOptions := namedMap .getBaseClient ().cacheOpts .NearCacheOptions
123147 if ncOptions == nil {
@@ -128,11 +152,13 @@ func GetNearCachePruneFactor[K comparable, V any](namedMap NamedMap[K, V]) float
128152}
129153
130154// revive:disable:unexported-return
155+ // GetKeyListenerGroupMap is only exported for integration tests, not for general use.
131156func GetKeyListenerGroupMap [K comparable , V any ](namedMap NamedMap [K , V ]) map [K ]* listenerGroupV1 [K , V ] {
132157 return namedMap .getBaseClient ().keyListenersV1
133158}
134159
135160// revive:disable:unexported-return
161+ // GetKeyListenerGroupListeners is only exported for integration tests, not for general use.
136162func GetKeyListenerGroupListeners [K comparable , V any ](namedMap NamedMap [K , V ], key K ) []MapListener [K , V ] {
137163 mapListeners := make ([]MapListener [K , V ], 0 )
138164 listenerGroupMap := GetKeyListenerGroupMap [K , V ](namedMap )
@@ -146,10 +172,12 @@ func GetKeyListenerGroupListeners[K comparable, V any](namedMap NamedMap[K, V],
146172}
147173
148174// revive:disable:unexported-return
175+ // GetFilterListenerGroupMap is only exported for integration tests, not for general use.
149176func GetFilterListenerGroupMap [K comparable , V any ](namedMap NamedMap [K , V ]) map [filters.Filter ]* listenerGroupV1 [K , V ] {
150177 return namedMap .getBaseClient ().filterListenersV1
151178}
152179
180+ // GetFilterListenerGroupListeners is only exported for integration tests, not for general use.
153181func GetFilterListenerGroupListeners [K comparable , V any ](namedMap NamedMap [K , V ], f filters.Filter ) []MapListener [K , V ] {
154182 mapListeners := make ([]MapListener [K , V ], 0 )
155183 listenerGroupMap := GetFilterListenerGroupMap [K , V ](namedMap )
@@ -161,11 +189,3 @@ func GetFilterListenerGroupListeners[K comparable, V any](namedMap NamedMap[K, V
161189
162190 return mapListeners
163191}
164-
165- func GetCacheServiceProtocol () V1ProxyProtocol {
166- return cacheServiceProtocol
167- }
168-
169- func NewEnsureCacheRequest (session * Session , cache string ) (* pb1.ProxyRequest , error ) {
170- return session .v1StreamManagerCache .newEnsureCacheRequest (cache )
171- }
0 commit comments