aboutsummaryrefslogtreecommitdiffstats
path: root/library/go/blockcodecs/nop_codec.go
blob: c15e65a29eca6024c5393ddba039c040613f02d6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package blockcodecs

type nopCodec struct{}

func (n nopCodec) ID() CodecID {
	return 54476
}

func (n nopCodec) Name() string {
	return "null"
}

func (n nopCodec) DecodedLen(in []byte) (int, error) {
	return len(in), nil
}

func (n nopCodec) Encode(dst, src []byte) ([]byte, error) {
	return append(dst[:0], src...), nil
}

func (n nopCodec) Decode(dst, src []byte) ([]byte, error) {
	return append(dst[:0], src...), nil
}

func init() {
	Register(nopCodec{})
}