v1.14.0
ADDED: * iox package * mapsx package * netx/inetcksum package
This commit is contained in:
28
iox/funcs_chunklocker.go
Normal file
28
iox/funcs_chunklocker.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package iox
|
||||
|
||||
// GetChunkLen returns the current chunk size/length in bytes.
|
||||
func (c *ChunkLocker) GetChunkLen() (size uint) {
|
||||
|
||||
c.lock.RLock()
|
||||
defer c.lock.RUnlock()
|
||||
|
||||
size = c.chunkLen
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// SetChunkLen sets the current chunk size/length in bytes.
|
||||
func (c *ChunkLocker) SetChunkLen(size uint) (err error) {
|
||||
|
||||
if size == 0 {
|
||||
err = ErrInvalidChunkSize
|
||||
return
|
||||
}
|
||||
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
||||
c.chunkLen = size
|
||||
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user