github.com/authzed/spicedb@v1.32.1-0.20240520085336-ebda56537386/pkg/middleware/consistency/consistency.go (about)

     1  package consistency
     2  
     3  import (
     4  	"context"
     5  
     6  	v1 "github.com/authzed/authzed-go/proto/authzed/api/v1"
     7  
     8  	"github.com/authzed/spicedb/internal/middleware/consistency"
     9  	"github.com/authzed/spicedb/pkg/datastore"
    10  )
    11  
    12  // RevisionFromContext reads the selected revision out of a context.Context, computes a zedtoken
    13  // from it, and returns an internal error if it has not been set on the context.
    14  func RevisionFromContext(ctx context.Context) (datastore.Revision, *v1.ZedToken, error) {
    15  	return consistency.RevisionFromContext(ctx)
    16  }