- Copy envd source from e2b-dev/infra, internalize shared dependencies
into envd/internal/shared/ (keys, filesystem, id, smap, utils)
- Switch from gRPC to Connect RPC for all envd services
- Update module paths to git.omukk.dev/wrenn/{sandbox,sandbox/envd}
- Add proto specs (process, filesystem) with buf-based code generation
- Implement full envd: process exec, filesystem ops, port forwarding,
cgroup management, MMDS integration, and HTTP API
- Update main module dependencies (firecracker SDK, pgx, goose, etc.)
- Remove placeholder .gitkeep files replaced by real implementations
28 lines
313 B
Go
28 lines
313 B
Go
package utils
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
type AtomicMax struct {
|
|
val int64
|
|
mu sync.Mutex
|
|
}
|
|
|
|
func NewAtomicMax() *AtomicMax {
|
|
return &AtomicMax{}
|
|
}
|
|
|
|
func (a *AtomicMax) SetToGreater(newValue int64) bool {
|
|
a.mu.Lock()
|
|
defer a.mu.Unlock()
|
|
|
|
if a.val > newValue {
|
|
return false
|
|
}
|
|
|
|
a.val = newValue
|
|
|
|
return true
|
|
}
|