Skip to content

Commit 4240764

Browse files
author
Tim Middleton
authored
Initial near cache prototype (#71)
* Initial near cache prototype * Fix tests * Add example
1 parent 836fd15 commit 4240764

29 files changed

+2556
-94
lines changed

.github/workflows/build-compatability-2206.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ jobs:
2323
fail-fast: false
2424
matrix:
2525
coherenceVersion:
26-
- 22.06.6
2726
- 22.06.7
2827
- 22.06.8-SNAPSHOT
2928
go-version:
3029
- 1.19.x
3130
- 1.20.x
3231
- 1.21.x
32+
- 1.22.x
3333

3434
# Checkout the source, we need a depth of zero to fetch all of the history otherwise
3535
# the copyright check cannot work out the date of the files from Git.

.github/workflows/build-compatability.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ jobs:
2525
coherenceVersion:
2626
- 23.09.3-SNAPSHOT
2727
- 23.09.2
28-
- 23.09.1
2928
go-version:
3029
- 1.19.x
3130
- 1.20.x
3231
- 1.21.x
32+
- 1.22.x
3333

3434
# Checkout the source, we need a depth of zero to fetch all of the history otherwise
3535
# the copyright check cannot work out the date of the files from Git.

.github/workflows/build.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ on:
1616
jobs:
1717
build:
1818
runs-on: ubuntu-latest
19+
timeout-minutes: 60
1920
strategy:
2021
matrix:
2122
go-version:
2223
- 1.19.x
2324
- 1.20.x
2425
- 1.21.x
26+
- 1.22.x
2527

2628
# Checkout the source, we need a depth of zero to fetch all of the history otherwise
2729
# the copyright check cannot work out the date of the files from Git.
@@ -105,6 +107,7 @@ jobs:
105107
COHERENCE_TLS_CLIENT_KEY=`pwd`/test/utils/certs/star-lord.key \
106108
COHERENCE_VERSION=22.06.7 PROFILES=,secure,-jakarta,javax make clean certs generate-proto build-test-images test-e2e-standalone
107109
110+
108111
- name: E2E Local Tests SSL (options)
109112
shell: bash
110113
run: |

.github/workflows/discovery-compatability-tests.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
coherenceVersion:
23-
- 22.06.6
2423
- 22.06.7
2524
- 22.06.8-SNAPSHOT
26-
- 23.09.1
2725
- 23.09.2
2826
- 23.09.3-SNAPSHOT
2927
go-version:
3028
- 1.19.x
3129
- 1.20.x
3230
- 1.21.x
31+
- 1.22.x
3332

3433
# Checkout the source, we need a depth of zero to fetch all of the history otherwise
3534
# the copyright check cannot work out the date of the files from Git.

.github/workflows/discovery-snapshot-tests-22.06.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
- 1.19.x
2929
- 1.20.x
3030
- 1.21.x
31+
- 1.22.x
3132

3233
# Checkout the source, we need a depth of zero to fetch all of the history otherwise
3334
# the copyright check cannot work out the date of the files from Git.

.github/workflows/examples-jakarta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
coherenceVersion:
23-
- 23.09.1
2423
- 23.09.2
2524
- 23.09.3-SNAPSHOT
2625
go-version:
2726
- 1.19.x
2827
- 1.20.x
2928
- 1.21.x
29+
- 1.22.x
3030

3131
# Checkout the source, we need a depth of zero to fetch all of the history otherwise
3232
# the copyright check cannot work out the date of the files from Git.

.github/workflows/examples.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ jobs:
2121
matrix:
2222
coherenceVersion:
2323
- 22.06.8-SNAPSHOT
24-
- 22.06.6
2524
- 22.06.7
2625
go-version:
2726
- 1.19.x
2827
- 1.20.x
2928
- 1.21.x
29+
- 1.22.x
3030

3131
# Checkout the source, we need a depth of zero to fetch all of the history otherwise
3232
# the copyright check cannot work out the date of the files from Git.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# ----------------------------------------------------------------------------------------------------------------------
99

1010
# This is the version of the coherence-go-client
11-
VERSION ?=1.0.3
11+
VERSION ?=1.1.0
1212
CURRDIR := $(shell pwd)
1313
USER_ID := $(shell echo "`id -u`:`id -g`")
1414

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ to a Coherence Cluster using gRPC for the network transport.
2323
* mutations such as insert, update and delete on Maps
2424
* map lifecycle events such as truncated, released or destroyed
2525
* session lifecycle events such as connected, disconnected, reconnected and closed
26-
* Support for storing Go structs as JSON as well as the ability to serialize to Java objects on the server for access from other Coherence language API's
26+
* Support for storing Go structs as JSON as well as the ability to serialize to Java objects on the server for access from other Coherence language API's
27+
* Near cache support to cache frequently accessed data in the Go client to avoid sending requests across the network
2728
* Full support for Go generics in all Coherence API's
2829

2930
#### Requirements
@@ -38,7 +39,7 @@ For local development, we recommend using the Coherence CE Docker image; it cont
3839
everything necessary for the client to operate correctly.
3940

4041
```bash
41-
docker run -d -p 1408:1408 -p 30000:30000 ghcr.io/oracle/coherence-ce:23.09.1
42+
docker run -d -p 1408:1408 -p 30000:30000 ghcr.io/oracle/coherence-ce:23.09.2
4243
```
4344

4445
## Installation

coherence/cache.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2022, 2024 Oracle and/or its affiliates.
33
* Licensed under the Universal Permissive License v 1.0 as shown at
44
* https://oss.oracle.com/licenses/upl.
55
*/
@@ -159,15 +159,15 @@ type NamedMap[K comparable, V any] interface {
159159
RemoveListener(ctx context.Context, listener MapListener[K, V]) error
160160

161161
// RemoveMapping removes the entry for the specified key only if it is currently
162-
// mapped to the specified value.
162+
// mapped to the specified value. Returns true if the value was removed.
163163
RemoveMapping(ctx context.Context, key K, value V) (bool, error)
164164

165165
// Replace replaces the entry for the specified key only if it is
166166
// currently mapped to some value.
167167
Replace(ctx context.Context, key K, value V) (*V, error)
168168

169169
// ReplaceMapping replaces the entry for the specified key only if it is
170-
// currently mapped to some value. Returns true if the value was replaced
170+
// currently mapped to the value. Returns true if the value was replaced.
171171
ReplaceMapping(ctx context.Context, key K, prevValue V, newValue V) (bool, error)
172172

173173
// Size returns the number of mappings contained within the NamedMap.
@@ -176,7 +176,7 @@ type NamedMap[K comparable, V any] interface {
176176
// GetSession returns the Session associated with the NamedMap.
177177
GetSession() *Session
178178

179-
// ValuesFilter return a view of filtered values contained in the NamedMap.
179+
// ValuesFilter returns a view of filtered values contained in the NamedMap.
180180
// The returned channel will be asynchronously filled with values in the
181181
// NamedMap that satisfy the filter.
182182
ValuesFilter(ctx context.Context, filter filters.Filter) <-chan *StreamedValue[V]
@@ -194,6 +194,10 @@ type NamedMap[K comparable, V any] interface {
194194
// storage-enabled members.
195195
// If it is not supported by the gRPC proxy, an error will be returned.
196196
IsReady(ctx context.Context) (bool, error)
197+
198+
// GetNearCacheStats returns the [CacheStats] for a near cache for a [NamedMap] or [NamedCache].
199+
// If no near cache is defined, nil is returned.
200+
GetNearCacheStats() CacheStats
197201
}
198202

199203
// NamedCache is syntactically identical in behaviour to a NamedMap, but additionally implements

0 commit comments

Comments
 (0)