forked from TrueCloudLab/frostfs-node
[#1559] local_object_storage: Provide readOnly flag to Open
We should be able to reopen storage in readonly in runtime. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
e38b0aa4ba
commit
1e786233bf
20 changed files with 70 additions and 49 deletions
|
@ -14,20 +14,20 @@ import (
|
|||
|
||||
// Open opens all Shard's components.
|
||||
func (s *Shard) Open() error {
|
||||
components := []interface{ Open() error }{
|
||||
components := []interface{ Open(bool) error }{
|
||||
s.blobStor, s.metaBase,
|
||||
}
|
||||
|
||||
if s.pilorama != nil {
|
||||
components = append(components, s.pilorama)
|
||||
}
|
||||
|
||||
if s.hasWriteCache() {
|
||||
components = append(components, s.writeCache)
|
||||
}
|
||||
|
||||
if s.pilorama != nil {
|
||||
components = append(components, s.pilorama)
|
||||
}
|
||||
|
||||
for _, component := range components {
|
||||
if err := component.Open(); err != nil {
|
||||
if err := component.Open(false); err != nil {
|
||||
return fmt.Errorf("could not open %T: %w", component, err)
|
||||
}
|
||||
}
|
||||
|
@ -48,14 +48,14 @@ func (s *Shard) Init() error {
|
|||
s.blobStor.Init, fMetabase,
|
||||
}
|
||||
|
||||
if s.pilorama != nil {
|
||||
components = append(components, s.pilorama.Init)
|
||||
}
|
||||
|
||||
if s.hasWriteCache() {
|
||||
components = append(components, s.writeCache.Init)
|
||||
}
|
||||
|
||||
if s.pilorama != nil {
|
||||
components = append(components, s.pilorama.Init)
|
||||
}
|
||||
|
||||
for _, component := range components {
|
||||
if err := component(); err != nil {
|
||||
return fmt.Errorf("could not initialize %T: %w", component, err)
|
||||
|
@ -162,14 +162,14 @@ func (s *Shard) refillMetabase() error {
|
|||
func (s *Shard) Close() error {
|
||||
components := []interface{ Close() error }{}
|
||||
|
||||
if s.hasWriteCache() {
|
||||
components = append(components, s.writeCache)
|
||||
}
|
||||
|
||||
if s.pilorama != nil {
|
||||
components = append(components, s.pilorama)
|
||||
}
|
||||
|
||||
if s.hasWriteCache() {
|
||||
components = append(components, s.writeCache)
|
||||
}
|
||||
|
||||
components = append(components, s.blobStor, s.metaBase)
|
||||
|
||||
for _, component := range components {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue