mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 10:12:35 +00:00
vault: ability to toggle mlock on core
This commit is contained in:
@@ -198,6 +198,7 @@ type CoreConfig struct {
|
|||||||
Physical physical.Backend
|
Physical physical.Backend
|
||||||
Logger *log.Logger
|
Logger *log.Logger
|
||||||
DisableCache bool // Disables the LRU cache on the physical backend
|
DisableCache bool // Disables the LRU cache on the physical backend
|
||||||
|
DisableMlock bool // Disables mlock syscall
|
||||||
CacheSize int // Custom cache size of zero for default
|
CacheSize int // Custom cache size of zero for default
|
||||||
AdvertiseAddr string // Set as the leader address for HA
|
AdvertiseAddr string // Set as the leader address for HA
|
||||||
}
|
}
|
||||||
@@ -223,10 +224,12 @@ func NewCore(conf *CoreConfig) (*Core, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !conf.DisableMlock {
|
||||||
// Ensure our memory usage is locked into physical RAM
|
// Ensure our memory usage is locked into physical RAM
|
||||||
if err := LockMemory(); err != nil {
|
if err := LockMemory(); err != nil {
|
||||||
return nil, fmt.Errorf("failed to lock memory: %v", err)
|
return nil, fmt.Errorf("failed to lock memory: %v", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Construct a new AES-GCM barrier
|
// Construct a new AES-GCM barrier
|
||||||
barrier, err := NewAESGCMBarrier(conf.Physical)
|
barrier, err := NewAESGCMBarrier(conf.Physical)
|
||||||
|
|||||||
Reference in New Issue
Block a user