in plugins/queue/mmap/meta/meta.go [68:93]
func NewMetaData(metaDir string, capacity int) (*Metadata, error) {
path := filepath.Join(metaDir, metaName)
metaFile, err := segment.NewSegment(path, metaSize)
if err != nil {
return nil, fmt.Errorf("error in crating the Metadata memory mapped file: %v", err)
}
m := &Metadata{
metaFile: metaFile,
name: metaName,
size: metaSize,
capacity: capacity,
}
v := m.GetVersion()
if v != 0 && v != metaVersion {
return nil, fmt.Errorf("metadata metaVersion is not matching, the Metadata metaVersion is %d", v)
}
c := m.GetCapacity()
if c != 0 && c != capacity {
return nil, fmt.Errorf("metadata catapacity is not equal to the old capacity, the old capacity is %d", c)
}
m.PutVersion(metaVersion)
m.PutCapacity(int64(capacity))
return m, nil
}