2020-05-11 18:57:46 +00:00
|
|
|
# package drpcmetadata
|
|
|
|
|
|
|
|
`import "storj.io/drpc/drpcmetadata"`
|
|
|
|
|
|
|
|
Package drpcmetadata define the structure of the metadata supported by drpc
|
|
|
|
library.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
#### func Add
|
|
|
|
|
|
|
|
```go
|
|
|
|
func Add(ctx context.Context, key, value string) context.Context
|
|
|
|
```
|
|
|
|
Add associates a key/value pair on the context.
|
|
|
|
|
|
|
|
#### func AddPairs
|
|
|
|
|
|
|
|
```go
|
2020-05-29 13:08:11 +00:00
|
|
|
func AddPairs(ctx context.Context, metadata map[string]string) context.Context
|
2020-05-11 18:57:46 +00:00
|
|
|
```
|
|
|
|
AddPairs attaches metadata onto a context and return the context.
|
|
|
|
|
|
|
|
#### func Decode
|
|
|
|
|
|
|
|
```go
|
2020-05-29 13:08:11 +00:00
|
|
|
func Decode(data []byte) (map[string]string, error)
|
2020-05-11 18:57:46 +00:00
|
|
|
```
|
2020-05-29 13:08:11 +00:00
|
|
|
Decode translate byte form of metadata into key/value metadata.
|
2020-05-11 18:57:46 +00:00
|
|
|
|
|
|
|
#### func Encode
|
|
|
|
|
|
|
|
```go
|
2020-05-29 13:08:11 +00:00
|
|
|
func Encode(buffer []byte, metadata map[string]string) ([]byte, error)
|
2020-05-11 18:57:46 +00:00
|
|
|
```
|
|
|
|
Encode generates byte form of the metadata and appends it onto the passed in
|
|
|
|
buffer.
|
2020-05-29 13:08:11 +00:00
|
|
|
|
|
|
|
#### func Get
|
|
|
|
|
|
|
|
```go
|
|
|
|
func Get(ctx context.Context) (map[string]string, bool)
|
|
|
|
```
|
|
|
|
Get returns all key/value pairs on the given context.
|