Reorganize the SRS (Simple Realtime Server) repository to follow a conventional Go project structure, setting the stage for a progressive transition from a C++ project to a Go project. The proxy, which was once contained within its own `proxy/` subdirectory, will now be converted into the initial Go module located at the root of the repository, serving as a template for subsequent Go modules. - **Go module at repo root:** `go.mod` moved to repo root, module renamed from `proxy` to `srsx`. The repo is now a proper Go project with `cmd/` and `internal/` at the top level. - **Elevation of Proxy Code:** Move the proxy code from `proxy/cmd/proxy-go/` to `cmd/proxy/`, and from `proxy/internal/` to `internal/`. The proxy serves as the inaugural application; subsequent modules (for instance, `cmd/origin`) will mimic this arrangement. - **Documentation Restructured:** Transfer the documentation from `proxy/docs/` to `docs/proxy/`, revise the main README to endorse OpenClaw as the preferred AI tool, and update `proxy/README.md` to point to the new documentation locations. - **Build and config:** `Makefile` moved to root, `PROXY_STATIC_FILES` default path corrected for the new layout, `.gitignore` consolidated. - **Cleanup:** removed standalone `proxy/LICENSE` (repo-level license applies), all internal imports updated to `srsx/internal/...`. - **OpenClaw workspace:** added community bot info, git workflow conventions, and support group behavior guidance. This restructuring was performed by OpenClaw orchestrating Claude Code and Codex via ACP. --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
46 lines
845 B
Go
46 lines
845 B
Go
// Copyright (c) 2025 Winlin
|
|
//
|
|
// SPDX-License-Identifier: MIT
|
|
package sync
|
|
|
|
import "sync"
|
|
|
|
type Map[K comparable, V any] struct {
|
|
m sync.Map
|
|
}
|
|
|
|
func (m *Map[K, V]) Delete(key K) {
|
|
m.m.Delete(key)
|
|
}
|
|
|
|
func (m *Map[K, V]) Load(key K) (value V, ok bool) {
|
|
v, ok := m.m.Load(key)
|
|
if !ok {
|
|
return value, ok
|
|
}
|
|
return v.(V), ok
|
|
}
|
|
|
|
func (m *Map[K, V]) LoadAndDelete(key K) (value V, loaded bool) {
|
|
v, loaded := m.m.LoadAndDelete(key)
|
|
if !loaded {
|
|
return value, loaded
|
|
}
|
|
return v.(V), loaded
|
|
}
|
|
|
|
func (m *Map[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool) {
|
|
a, loaded := m.m.LoadOrStore(key, value)
|
|
return a.(V), loaded
|
|
}
|
|
|
|
func (m *Map[K, V]) Range(f func(key K, value V) bool) {
|
|
m.m.Range(func(key, value any) bool {
|
|
return f(key.(K), value.(V))
|
|
})
|
|
}
|
|
|
|
func (m *Map[K, V]) Store(key K, value V) {
|
|
m.m.Store(key, value)
|
|
}
|