diff options
| author | Wayne-Cole <77279425+Wacky404@users.noreply.github.com> | 2026-06-15 21:30:52 -0500 |
|---|---|---|
| committer | Wayne-Cole <77279425+Wacky404@users.noreply.github.com> | 2026-06-15 21:30:52 -0500 |
| commit | 21b84094a397ab1ea690cc019b1dcd6698f71b50 (patch) | |
| tree | 0d384ef6f1f85553e9dc5675405cbc9febf40e66 /internal/lcommon.go | |
| parent | 1cfd8a143107ab4bc50092daa45407196df0b75d (diff) | |
| download | lurchers-main.tar.xz lurchers-main.zip | |
update: impl spawnWorker func via unix protocolmain
Diffstat (limited to 'internal/lcommon.go')
| -rw-r--r-- | internal/lcommon.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/internal/lcommon.go b/internal/lcommon.go index f6a846f..e06d310 100644 --- a/internal/lcommon.go +++ b/internal/lcommon.go @@ -130,6 +130,7 @@ func WithFileLevel(level slog.Level) func(*options) { * using the SPSC model * ======================================================= */ + const ( debug bool = false ) @@ -256,6 +257,43 @@ func Open(filename string) (*ReaderAt, error) { return r, nil } +/* + * ======================================================= + * Lurchers Misc + * ======================================================= + */ + func unsafePointerAt(data []byte, offset int) unsafe.Pointer { return unsafe.Pointer(&data[offset]) } + +type ( + workspace int8 + lurchersIdsTrack map[workspace]int +) + +type idOptions struct { + workspace workspace +} + +var id lurchersIdsTrack = map[workspace]int{} + +func Id(opts ...func(*idOptions)) int { + o := idOptions{ + workspace: 1, + } + + for _, opt := range opts { + opt(&o) + } + + id[o.workspace] = id[o.workspace] + 1 + + return id[o.workspace] +} + +func WithWorkSpace(ws workspace) func(*idOptions) { + return func(o *idOptions) { + o.workspace = ws + } +} |
