mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-18 10:07:02 +00:00
Reorganize packages, closes #79
- All packages go into either cmd or pkg directories - Most packages renamed - Server packages moved into pkg/server - sanitize moved into webui, as that's the only place it's used - filestore moved into pkg/storage/file - Makefile updated, and PKG variable use fixed
This commit is contained in:
19
pkg/storage/lock.go
Normal file
19
pkg/storage/lock.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package datastore
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type HashLock [4096]sync.RWMutex
|
||||
|
||||
func (h *HashLock) Get(hash string) *sync.RWMutex {
|
||||
if len(hash) < 3 {
|
||||
return nil
|
||||
}
|
||||
i, err := strconv.ParseInt(hash[0:3], 16, 0)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return &h[i]
|
||||
}
|
||||
Reference in New Issue
Block a user