$ show hazelcast/hazelcast-go-client
This repository is the official Hazelcast Go client library, providing a robust SDK for interacting with Hazelcast distributed in-memory data grids. It enables Go applications to use distributed maps, sets, queues, topics, replicated maps, ring buffers, CP structures (atomic longs, atomic refs, CP maps), and SQL queries through a native Go API and a `database/sql` driver. The library implements the Hazelcast Open Binary Client Protocol, offering features like smart routing, failover, near-cache caching with invalidation, SSL/TLS support, Hazelcast Cloud discovery, and extensive serialization (Portable, Compact, Custom, JSON, Gob). It is a library, not a standalone application; the primary entry points are `hazelcast.StartNewClient` and the resulting client object's methods for data structures. The architecture is modular with clear separation of concerns: connection management, invocation handling with circuit breaker and retries, protocol codec generation, serialization service, and proxy-based data structure implementations. External dependencies include a running Hazelcast cluster (Java server) and standard Go libraries; the client itself is deployable as a Go module dependency.
The LLM identified 4 files worth highlighting for reuse:
A generic circuit breaker implementation with configurable max retries, max failure count, reset timeout, non-retryable error wrapping, and state change handlers. Used internally for connection attempts and CP invocations. Self-contained package with no dependencies on other internal packages, making it easily extractable for any Go project needing retry logic with circuit breaking.
A pure Go implementation of Murmur3A hash (32-bit) and a partition index function. Self-contained, tested, and used for partitioning keys in cluster operations. Reusable as a lightweight hashing utility without the overhead of the full library.
An atomic reference ID generator that produces monotonically increasing uint64 IDs with default start at 1. Implemented with atomic operations, no locking. Useful for any Go project that needs unique, incremental IDs without external dependencies.
Utility functions `Must` and `MustValue` for panicking on errors, a common Go pattern for initialization code. Also includes `Nil` and pointer validation helpers. Simple, self-contained, and easily reusable for defensive error handling in any Go codebase.