---
title: kvstore
summary: Package kvstore provides access to Fastly KV stores.
url: https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/kvstore/
---

**Kind:** Module  
**Package:** compute-sdk-go v1.11.0  
**Path:** `github.com/fastly/compute-sdk-go/kvstore`

Package kvstore provides access to Fastly KV stores.

KV stores provide durable storage of key/value data that is readable
and writable at the edge and synchronized globally.

See the [Fastly KV store documentation](https://developer.fastly.com/learning/concepts/data-stores/#kv-stores) for details.

## Structs

| Name | Summary |
| --- | --- |
| [Entry](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/kvstore/struct.Entry/) | Entry represents a KV store value. |
| [InsertConfig](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/kvstore/struct.InsertConfig/) |  |
| [ListConfig](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/kvstore/struct.ListConfig/) | ListConfig holds the option for the List operation. |
| [ListIter](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/kvstore/struct.ListIter/) | ListIter is an iterator over pages of List results. |
| [ListMetadata](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/kvstore/struct.ListMetadata/) | ListMetadata is the metadata for a particular page of list results.[ |
| [ListPage](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/kvstore/struct.ListPage/) |  |
| [Store](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/kvstore/struct.Store/) | Store represents a Fastly KV store |

## Type aliases

| Name | Summary |
| --- | --- |
| [InsertMode](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/kvstore/type.InsertMode/) |  |
| [ListConsistency](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/kvstore/type.ListConsistency/) |  |

## Functions

| Name | Summary |
| --- | --- |
| [Open](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/kvstore/fn.Open/) | Open returns a handle to the named kv store |

## Constants

### InsertModeAdd

**Type:** `fastly.KVInsertMode`  
**Default:** `fastly.KVInsertModeAdd`  
**Flags:** read-only  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/kvstore/kvstore.go#L148

### InsertModeAppend

**Type:** `fastly.KVInsertMode`  
**Default:** `fastly.KVInsertModeAppend`  
**Flags:** read-only  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/kvstore/kvstore.go#L149

### InsertModeOverwrite

**Type:** `fastly.KVInsertMode`  
**Default:** `fastly.KVInsertModeOverwrite`  
**Flags:** read-only  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/kvstore/kvstore.go#L147

### InsertModePrepend

**Type:** `fastly.KVInsertMode`  
**Default:** `fastly.KVInsertModePrepend`  
**Flags:** read-only  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/kvstore/kvstore.go#L150

### ListConsistencyEventual

**Type:** `fastly.KVListMode`  
**Default:** `fastly.KVListModeEventual`  
**Flags:** read-only  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/kvstore/kvstore.go#L224

### ListConsistencyStrong

**Type:** `fastly.KVListMode`  
**Default:** `fastly.KVListModeStrong`  
**Flags:** read-only  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/kvstore/kvstore.go#L223

## Variables

### ErrBadRequest

**Type:** `error`  
**Default:** `errors.New("kvstore: bad request")`  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/kvstore/kvstore.go#L39

ErrBadRequest indicates the KV Store request was bad.

### ErrInvalidKey

**Type:** `error`  
**Default:** `errors.New("kvstore: invalid key")`  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/kvstore/kvstore.go#L29

ErrInvalidKey indicates that the given key is invalid.

### ErrInvalidOptions

**Type:** `error`  
**Default:** `errors.New("kvstore: invalid options")`  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/kvstore/kvstore.go#L36

ErrInvalidOptions indicates the options provided for this operation were invalid.

### ErrKeyNotFound

**Type:** `error`  
**Default:** `errors.New("kvstore: key not found")`  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/kvstore/kvstore.go#L26

ErrKeyNotFound indicates that the named key doesn't exist in this
KV store.

### ErrPayloadTooLarge

**Type:** `error`  
**Default:** `errors.New("kvstore: payload too large")`  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/kvstore/kvstore.go#L45

ErrPayloadTooLarge indicates the item exceeded the payload limit.

### ErrPreconditionFailed

**Type:** `error`  
**Default:** `errors.New("kvstore: precondition failed")`  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/kvstore/kvstore.go#L42

ErrPreconditionFailed indicates a precondition for the kvstore operation failed.

### ErrStoreNotFound

**Type:** `error`  
**Default:** `errors.New("kvstore: store not found")`  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/kvstore/kvstore.go#L22

ErrStoreNotFound indicates that the named store doesn't exist.

### ErrTooManyRequests

**Type:** `error`  
**Default:** `errors.New("kvstore: too many requests")`  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/kvstore/kvstore.go#L33

ErrTooManyRequests is returned when inserting a value exceeds the
rate limit.

### ErrUnexpected

**Type:** `error`  
**Default:** `errors.New("kvstore: unexpected error")`  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/kvstore/kvstore.go#L48

ErrUnexpected indicates than an unexpected error occurred.
