mirror of
https://github.com/luxfi/container.git
synced 2026-09-24 00:24:34 +00:00
Modules declare go 1.27.1 and the build images follow. go fix applied the modernizers: any, WaitGroup.Go, range over int, and a promoted-field key in a struct literal. omitzero is not applied, since it changes what the JSON says. Co-authored-by: Hanzo Dev <[email protected]>
35 lines
675 B
Go
35 lines
675 B
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
// Package container provides core container interfaces and implementations
|
|
package container
|
|
|
|
// List interface for sequential data
|
|
type List[T any] interface {
|
|
Front() any
|
|
Back() any
|
|
PushFront(T)
|
|
PushBack(T)
|
|
Remove(any)
|
|
Len() int
|
|
}
|
|
|
|
// Map interface for key-value storage
|
|
type Map[K comparable, V any] interface {
|
|
Put(K, V)
|
|
Get(K) (V, bool)
|
|
Delete(K)
|
|
Len() int
|
|
Oldest() (K, V, bool)
|
|
Clear()
|
|
}
|
|
|
|
// Cache interface for size-bounded storage
|
|
type Cache[K comparable, V any] interface {
|
|
Put(K, V)
|
|
Get(K) (V, bool)
|
|
Delete(K)
|
|
Len() int
|
|
Evict(K)
|
|
}
|