summaryrefslogtreecommitdiff
path: root/internal/lcommon.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/lcommon.go')
-rw-r--r--internal/lcommon.go38
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
+ }
+}