Push adds the item to the list
(data []byte)
| 81 | |
| 82 | // Push adds the item to the list |
| 83 | func (cl *ChunkList) Push(data []byte) bool { |
| 84 | cl.mutex.Lock() |
| 85 | |
| 86 | if len(cl.chunks) == 0 || cl.lastChunk().IsFull() { |
| 87 | cl.chunks = append(cl.chunks, &Chunk{}) |
| 88 | } |
| 89 | |
| 90 | ret := cl.lastChunk().push(cl.trans, data) |
| 91 | cl.mutex.Unlock() |
| 92 | return ret |
| 93 | } |
| 94 | |
| 95 | // Clear clears the data |
| 96 | func (cl *ChunkList) Clear() { |