github.com/authzed/spicedb@v1.32.1-0.20240520085336-ebda56537386/internal/datastore/memdb/errors.go (about) 1 package memdb 2 3 import ( 4 "google.golang.org/grpc/codes" 5 "google.golang.org/grpc/status" 6 7 v1 "github.com/authzed/authzed-go/proto/authzed/api/v1" 8 9 "github.com/authzed/spicedb/pkg/spiceerrors" 10 ) 11 12 // ErrSerializationMaxRetriesReached occurs when a write request has reached its maximum number 13 // of retries due to serialization errors. 14 type ErrSerializationMaxRetriesReached struct { 15 error 16 } 17 18 // NewSerializationMaxRetriesReachedErr constructs a new max retries reached error. 19 func NewSerializationMaxRetriesReachedErr(baseErr error) error { 20 return ErrSerializationMaxRetriesReached{ 21 error: baseErr, 22 } 23 } 24 25 // GRPCStatus implements retrieving the gRPC status for the error. 26 func (err ErrSerializationMaxRetriesReached) GRPCStatus() *status.Status { 27 return spiceerrors.WithCodeAndDetails( 28 err, 29 codes.DeadlineExceeded, 30 spiceerrors.ForReason( 31 v1.ErrorReason_ERROR_REASON_UNSPECIFIED, 32 map[string]string{ 33 "details": "too many updates were made to the in-memory datastore at once; this datastore has limited write throughput capability", 34 }, 35 ), 36 ) 37 }