Added goals, cache and func to get any remote obj
Cache is for storage, also includes pooled encoders and decoders goals are things to eventually add to Linstrom
This commit is contained in:
parent
2977f09245
commit
8709238859
8 changed files with 907 additions and 16 deletions
35
storage/cache/lockedCoders.go
vendored
Normal file
35
storage/cache/lockedCoders.go
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
package cache
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/gob"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type gobEncoder struct {
|
||||
sync.Mutex
|
||||
Encoder *gob.Encoder
|
||||
Buffer *bytes.Buffer
|
||||
}
|
||||
|
||||
func newEncoder() gobEncoder {
|
||||
buf := bytes.Buffer{}
|
||||
return gobEncoder{
|
||||
Encoder: gob.NewEncoder(&buf),
|
||||
Buffer: &buf,
|
||||
}
|
||||
}
|
||||
|
||||
type gobDecoder struct {
|
||||
sync.Mutex
|
||||
Decoder *gob.Decoder
|
||||
Buffer *bytes.Buffer
|
||||
}
|
||||
|
||||
func newDecoder() gobDecoder {
|
||||
buf := bytes.Buffer{}
|
||||
return gobDecoder{
|
||||
Decoder: gob.NewDecoder(&buf),
|
||||
Buffer: &buf,
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue