@@ -32,15 +32,16 @@ import (
3232)
3333
3434//go:generate msgp -file $GOFILE -unexported
35- //msgp:ignore tierJournal tierDiskJournal walkfn
35+ //msgp:ignore TierJournal tierDiskJournal walkfn
3636
3737type tierDiskJournal struct {
3838 sync.RWMutex
3939 diskPath string
4040 file * os.File // active journal file
4141}
4242
43- type tierJournal struct {
43+ // TierJournal holds an in-memory and an on-disk delete journal of tiered content.
44+ type TierJournal struct {
4445 * tierDiskJournal // for processing legacy journal entries
4546 * tierMemJournal // for processing new journal entries
4647}
@@ -62,24 +63,28 @@ func newTierDiskJournal() *tierDiskJournal {
6263 return & tierDiskJournal {}
6364}
6465
65- // initTierDeletionJournal intializes an in-memory journal built using a
66- // buffered channel for new journal entries. It also initializes the on-disk
67- // journal only to process existing journal entries made from previous versions.
68- func initTierDeletionJournal (ctx context.Context ) (* tierJournal , error ) {
69- j := & tierJournal {
70- tierMemJournal : newTierMemJoural (1000 ),
66+ // NewTierJournal initializes tier deletion journal
67+ func NewTierJournal () * TierJournal {
68+ j := & TierJournal {
69+ tierMemJournal : newTierMemJournal (1000 ),
7170 tierDiskJournal : newTierDiskJournal (),
7271 }
72+ return j
73+ }
7374
75+ // Init intializes an in-memory journal built using a
76+ // buffered channel for new journal entries. It also initializes the on-disk
77+ // journal only to process existing journal entries made from previous versions.
78+ func (t * TierJournal ) Init (ctx context.Context ) error {
7479 for _ , diskPath := range globalEndpoints .LocalDisksPaths () {
75- j .diskPath = diskPath
80+ t .diskPath = diskPath
7681
77- go j .deletePending (ctx ) // for existing journal entries from previous MinIO versions
78- go j .processEntries (ctx ) // for newer journal entries circa free-versions
79- return j , nil
82+ go t .deletePending (ctx ) // for existing journal entries from previous MinIO versions
83+ go t .processEntries (ctx ) // for newer journal entries circa free-versions
84+ return nil
8085 }
8186
82- return nil , errors .New ("no local drive found" )
87+ return errors .New ("no local drive found" )
8388}
8489
8590// rotate rotates the journal. If a read-only journal already exists it does
0 commit comments