@@ -27,46 +27,36 @@ func NewRecord(size int) *Record {
2727// Set store data to record memory. On output we have bytes, which are copied to
2828// record data property and size is set.
2929func (r * Record ) Set (data []byte ) {
30- // r.Lock() // Lock for writing and reading
3130 if len (data ) > r .size {
3231 r .alloc = r .size
3332 } else {
3433 r .alloc = len (data )
3534 }
3635 copy (r .data , data )
37- // r.Unlock() // Unlock for writing and reading
3836}
3937
4038// Get returns bytes based on size of virtual allocation. It means that it
4139// returns only specific count of bytes, based on alloc property. If array on
4240// output is empty, then record is not exists.
4341func (r * Record ) Get () (data []byte ) {
44- // r.RLock() // Lock for reading
4542 data = r .data [:r .alloc ]
46- // r.RUnlock() // Unlock for reading
4743 return
4844}
4945
5046// Free set alloc property to 0. Through this action, we empty memory of record
5147// without calling garbage collector.
5248func (r * Record ) Free () {
53- // r.Lock() // Lock for writing and reading
5449 r .alloc = 0
55- // r.Unlock() // Unlock for writing and reading
5650}
5751
5852// GetAllocated returns size of allocated bytes.
5953func (r * Record ) GetAllocated () (size int ) {
60- // r.RLock() // Lock for reading
6154 size = r .alloc
62- // r.RUnlock() // Unlock for reading
6355 return
6456}
6557
6658// GetDataLength returns real size of allocated bytes in memory.
6759func (r * Record ) GetDataLength () (size int ) {
68- // r.RLock() // Lock for reading
6960 size = len (r .data )
70- // r.RUnlock() // Unlock for reading
7161 return
7262}
0 commit comments