aboutsummaryrefslogtreecommitdiff
path: root/go
diff options
context:
space:
mode:
authorJianfei Wang <me@thinxer.com>2016-04-10 13:47:03 +0800
committerJianfei Wang <me@thinxer.com>2016-04-10 13:47:03 +0800
commita192373c251c821bf35a7e614cd286a28667071d (patch)
treeaa81c3362cf4e1695623a83783d063e3f597f167 /go
parent3523ad523929870aa8d4a7741ee8e152cfd40489 (diff)
downloadseaweedfs-a192373c251c821bf35a7e614cd286a28667071d.tar.xz
seaweedfs-a192373c251c821bf35a7e614cd286a28667071d.zip
storage: do not copy sync.Mutex by value
Diffstat (limited to 'go')
-rw-r--r--go/storage/needle_map.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/go/storage/needle_map.go b/go/storage/needle_map.go
index 41f53b90b..13fe4ffb1 100644
--- a/go/storage/needle_map.go
+++ b/go/storage/needle_map.go
@@ -39,7 +39,7 @@ type baseNeedleMapper struct {
mapMetric
}
-func (nm baseNeedleMapper) IndexFileSize() uint64 {
+func (nm *baseNeedleMapper) IndexFileSize() uint64 {
stat, err := nm.indexFile.Stat()
if err == nil {
return uint64(stat.Size())
@@ -47,7 +47,7 @@ func (nm baseNeedleMapper) IndexFileSize() uint64 {
return 0
}
-func (nm baseNeedleMapper) IndexFileName() string {
+func (nm *baseNeedleMapper) IndexFileName() string {
return nm.indexFile.Name()
}
@@ -57,7 +57,7 @@ func idxFileEntry(bytes []byte) (key uint64, offset uint32, size uint32) {
size = binary.BigEndian.Uint32(bytes[12:16])
return
}
-func (nm baseNeedleMapper) appendToIndexFile(key uint64, offset uint32, size uint32) error {
+func (nm *baseNeedleMapper) appendToIndexFile(key uint64, offset uint32, size uint32) error {
bytes := make([]byte, 16)
binary.BigEndian.PutUint64(bytes[0:8], key)
binary.BigEndian.PutUint32(bytes[8:12], offset)
@@ -72,7 +72,7 @@ func (nm baseNeedleMapper) appendToIndexFile(key uint64, offset uint32, size uin
_, err := nm.indexFile.Write(bytes)
return err
}
-func (nm baseNeedleMapper) IndexFileContent() ([]byte, error) {
+func (nm *baseNeedleMapper) IndexFileContent() ([]byte, error) {
nm.indexFileAccessLock.Lock()
defer nm.indexFileAccessLock.Unlock()
return ioutil.ReadFile(nm.indexFile.Name())