chrislu
9 months ago
6 changed files with 51 additions and 18 deletions
-
23weed/operation/upload_content.go
-
2weed/server/filer_grpc_server.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