Konstantin Lebedev
9 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 50 additions and 17 deletions
-
25weed/operation/upload_content.go
-
6weed/server/volume_server_handlers_write.go
-
12weed/storage/needle/needle_write.go
-
4weed/topology/store_replicate.go
-
20weed/util/buffer_pool/sync_pool.go
@ -0,0 +1,20 @@ |
|||
package buffer_pool |
|||
|
|||
import ( |
|||
"bytes" |
|||
"sync" |
|||
) |
|||
|
|||
var syncPool = sync.Pool{ |
|||
New: func() interface{} { |
|||
return new(bytes.Buffer) |
|||
}, |
|||
} |
|||
|
|||
func SyncPoolGetBuffer() *bytes.Buffer { |
|||
return syncPool.Get().(*bytes.Buffer) |
|||
} |
|||
|
|||
func SyncPoolPutBuffer(buffer *bytes.Buffer) { |
|||
syncPool.Put(buffer) |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue