mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-22 00:47:24 +08:00
go fmt and fix some typo
This commit is contained in:
@@ -29,12 +29,12 @@ type Needle struct {
|
||||
|
||||
DataSize uint32 `comment:"Data size"` //version2
|
||||
Data []byte `comment:"The actual file data"`
|
||||
Flags byte `comment:"boolean flags"` //version2
|
||||
NameSize uint8 //version2
|
||||
Flags byte `comment:"boolean flags"` //version2
|
||||
NameSize uint8 //version2
|
||||
Name []byte `comment:"maximum 256 characters"` //version2
|
||||
MimeSize uint8 //version2
|
||||
MimeSize uint8 //version2
|
||||
Mime []byte `comment:"maximum 256 characters"` //version2
|
||||
PairsSize uint16 //version2
|
||||
PairsSize uint16 //version2
|
||||
Pairs []byte `comment:"additional name value pairs, json format, maximum 64kB"`
|
||||
LastModified uint64 //only store LastModifiedBytesLength bytes, which is 5 bytes to disk
|
||||
Ttl *TTL
|
||||
|
@@ -4,11 +4,11 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestReplicaPlacemnetSerialDeserial(t *testing.T) {
|
||||
func TestReplicaPlacementSerialDeserial(t *testing.T) {
|
||||
rp, _ := NewReplicaPlacementFromString("001")
|
||||
new_rp, _ := NewReplicaPlacementFromByte(rp.Byte())
|
||||
if rp.String() != new_rp.String() {
|
||||
println("expected:", rp.String(), "actual:", new_rp.String())
|
||||
newRp, _ := NewReplicaPlacementFromByte(rp.Byte())
|
||||
if rp.String() != newRp.String() {
|
||||
println("expected:", rp.String(), "actual:", newRp.String())
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
@@ -163,7 +163,7 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
||||
}
|
||||
volumeMessages = append(volumeMessages, volumeMessage)
|
||||
} else {
|
||||
if v.exiredLongEnough(MAX_TTL_VOLUME_REMOVAL_DELAY) {
|
||||
if v.expiredLongEnough(MAX_TTL_VOLUME_REMOVAL_DELAY) {
|
||||
location.deleteVolumeById(v.Id)
|
||||
glog.V(0).Infoln("volume", v.Id, "is deleted.")
|
||||
} else {
|
||||
@@ -265,4 +265,3 @@ func (s *Store) DeleteVolume(i VolumeId) error {
|
||||
|
||||
return fmt.Errorf("Volume %d not found on disk", i)
|
||||
}
|
||||
|
||||
|
@@ -120,7 +120,7 @@ func (v *Volume) expired(volumeSizeLimit uint64) bool {
|
||||
}
|
||||
|
||||
// wait either maxDelayMinutes or 10% of ttl minutes
|
||||
func (v *Volume) exiredLongEnough(maxDelayMinutes uint32) bool {
|
||||
func (v *Volume) expiredLongEnough(maxDelayMinutes uint32) bool {
|
||||
if v.Ttl == nil || v.Ttl.Minutes() == 0 {
|
||||
return false
|
||||
}
|
||||
|
@@ -137,10 +137,10 @@ func (v *Volume) makeupDiff(newDatFileName, newIdxFileName, oldDatFileName, oldI
|
||||
}
|
||||
incrementedHasUpdatedIndexEntry := make(map[NeedleId]keyField)
|
||||
|
||||
for idx_offset := indexSize - NeedleEntrySize; uint64(idx_offset) >= v.lastCompactIndexOffset; idx_offset -= NeedleEntrySize {
|
||||
for idxOffset := indexSize - NeedleEntrySize; uint64(idxOffset) >= v.lastCompactIndexOffset; idxOffset -= NeedleEntrySize {
|
||||
var IdxEntry []byte
|
||||
if IdxEntry, err = readIndexEntryAtOffset(oldIdxFile, idx_offset); err != nil {
|
||||
return fmt.Errorf("readIndexEntry %s at offset %d failed: %v", oldIdxFileName, idx_offset, err)
|
||||
if IdxEntry, err = readIndexEntryAtOffset(oldIdxFile, idxOffset); err != nil {
|
||||
return fmt.Errorf("readIndexEntry %s at offset %d failed: %v", oldIdxFileName, idxOffset, err)
|
||||
}
|
||||
key, offset, size := IdxFileEntry(IdxEntry)
|
||||
glog.V(4).Infof("key %d offset %d size %d", key, offset, size)
|
||||
|
Reference in New Issue
Block a user