Documentation
¶
Index ¶
- func AuthSuperAdmin(ctx context.Context) error
- func AuthorizeGuardians(ctx context.Context) error
- func GetGQLSchema(namespace uint64) (uid, graphQLSchema string, err error)
- func Init()
- func InitializeAcl(closer *z.Closer)
- func InsertDropRecord(ctx context.Context, dropOp string) error
- func ParseMutationObject(mu *api.Mutation, isGraphql bool) (*dql.Mutation, error)
- func ProcessPersistedQuery(ctx context.Context, gqlReq *schema.Request) error
- func RefreshACLs(ctx context.Context)
- func SubscribeForAclUpdates(closer *z.Closer)
- func UpdateGQLSchema(ctx context.Context, gqlSchema, dgraphSchema string) (*pb.UpdateGraphQLSchemaResponse, error)
- type AuthMode
- type GraphqlContextKey
- type Request
- type ResetPasswordInput
- type Server
- func (s *Server) Alter(ctx context.Context, op *api.Operation) (*api.Payload, error)
- func (s *Server) CheckVersion(ctx context.Context, c *api.Check) (v *api.Version, err error)
- func (s *Server) CommitOrAbort(ctx context.Context, tc *api.TxnContext) (*api.TxnContext, error)
- func (s *Server) CreateNamespaceInternal(ctx context.Context, passwd string) (uint64, error)
- func (s *Server) DeleteNamespace(ctx context.Context, namespace uint64) error
- func (s *Server) Health(ctx context.Context, all bool) (*api.Response, error)
- func (s *Server) Login(ctx context.Context, request *api.LoginRequest) (*api.Response, error)
- func (s *Server) Query(ctx context.Context, req *api.Request) (*api.Response, error)
- func (s *Server) QueryGraphQL(ctx context.Context, req *api.Request, field gqlSchema.Field) (*api.Response, error)
- func (s *Server) QueryNoAuth(ctx context.Context, req *api.Request) (*api.Response, error)
- func (s *Server) QueryNoGrpc(ctx context.Context, req *api.Request) (*api.Response, error)
- func (s *Server) ResetPassword(ctx context.Context, inp *ResetPasswordInput) error
- func (s *Server) State(ctx context.Context) (*api.Response, error)
- type ServerV25
- func (s *ServerV25) AllocateIDs(ctx context.Context, req *apiv2.AllocateIDsRequest) (*apiv2.AllocateIDsResponse, error)
- func (s *ServerV25) Alter(ctx context.Context, req *apiv2.AlterRequest) (*apiv2.AlterResponse, error)
- func (s *ServerV25) CreateNamespace(ctx context.Context, in *apiv2.CreateNamespaceRequest) (*apiv2.CreateNamespaceResponse, error)
- func (s *ServerV25) DropNamespace(ctx context.Context, in *apiv2.DropNamespaceRequest) (*apiv2.DropNamespaceResponse, error)
- func (s *ServerV25) InitiatePDirStream(ctx context.Context, c *apiv2.InitiatePDirStreamRequest) (v *apiv2.InitiatePDirStreamResponse, err error)
- func (s *ServerV25) ListNamespaces(ctx context.Context, in *apiv2.ListNamespacesRequest) (*apiv2.ListNamespacesResponse, error)
- func (s *ServerV25) Ping(ctx context.Context, req *apiv2.PingRequest) (*apiv2.PingResponse, error)
- func (s *ServerV25) RunDQL(ctx context.Context, req *apiv2.RunDQLRequest) (*apiv2.RunDQLResponse, error)
- func (s *ServerV25) SignInUser(ctx context.Context, request *apiv2.SignInUserRequest) (*apiv2.SignInUserResponse, error)
- func (s *ServerV25) StreamPDir(stream apiv2.Dgraph_StreamPDirServer) error
- func (s *ServerV25) UpdateNamespace(ctx context.Context, in *apiv2.UpdateNamespaceRequest) (*apiv2.UpdateNamespaceResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthSuperAdmin ¶
AuthSuperAdmin authorizes the operations for the users who belong to the guardians group in the galaxy namespace. This authorization is used for admin usages like creation and deletion of a namespace, resetting passwords across namespaces etc. NOTE: The caller should not wrap the error returned. If needed, propagate the GRPC error code.
func AuthorizeGuardians ¶
AuthorizeGuardians authorizes the operation for users which belong to Guardians group. NOTE: The caller should not wrap the error returned. If needed, propagate the GRPC error code.
func GetGQLSchema ¶
GetGQLSchema queries for the GraphQL schema node, and returns the uid and the GraphQL schema. If multiple schema nodes were found, it returns an error.
func InsertDropRecord ¶
InsertDropRecord is used to insert a helper record when a DROP operation is performed. This helper record lets us know during backup that a DROP operation was performed and that we need to write this information in backup manifest. So that while restoring from a backup series, we can create an exact replica of the system which existed at the time the last backup was taken. Note that if the server crashes after the DROP operation & before this helper record is inserted, then restoring from the incremental backup of such a DB would restore even the dropped data back. This is also used to capture the delete namespace operation during backup.
func ParseMutationObject ¶
ParseMutationObject tries to consolidate fields of the api.Mutation into the corresponding field of the returned dql.Mutation. For example, the 3 fields, api.Mutation#SetJson, api.Mutation#SetNquads and api.Mutation#Set are consolidated into the dql.Mutation.Set field. Similarly the 3 fields api.Mutation#DeleteJson, api.Mutation#DelNquads and api.Mutation#Del are merged into the dql.Mutation#Del field.
func ProcessPersistedQuery ¶
ProcessPersistedQuery stores and retrieves persisted queries by following waterfall logic:
- If sha256Hash is not provided process queries without persisting
- If sha256Hash is provided try retrieving persisted queries 2a. Persisted Query not found i) If query is not provided then throw "PersistedQueryNotFound" ii) If query is provided then store query in dgraph only if sha256 of the query is correct otherwise throw "provided sha does not match query" 2b. Persisted Query found i) If query is not provided then update gqlRes with the found query and proceed ii) If query is provided then match query retrieved, if identical do nothing else throw "query does not match persisted query"
func RefreshACLs ¶
func SubscribeForAclUpdates ¶
SubscribeForAclUpdates subscribes for ACL predicates and updates the acl cache.
func UpdateGQLSchema ¶
func UpdateGQLSchema(ctx context.Context, gqlSchema, dgraphSchema string) (*pb.UpdateGraphQLSchemaResponse, error)
UpdateGQLSchema updates the GraphQL and Dgraph schemas using the given inputs. It first validates and parses the dgraphSchema given in input. If that fails, it returns an error. All this is done on the alpha on which the update request is received. Then it sends an update request to the worker, which is executed only on Group-1 leader.
Types ¶
type GraphqlContextKey ¶
type GraphqlContextKey int
const ( // IsGraphql is used to validate requests which are allowed to mutate GraphQL reserved // predicates, like dgraph.graphql.schema and dgraph.graphql.xid. IsGraphql GraphqlContextKey = iota // Authorize is used to set if the request requires validation. Authorize )
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request represents a query request sent to the doQuery() method on the Server. It contains all the metadata required to execute a query.
type ResetPasswordInput ¶
type Server ¶
type Server struct {
// embedding the api.UnimplementedZeroServer struct to ensure forward compatibility of the server.
api.UnimplementedDgraphServer
}
Server implements protos.DgraphServer
func (*Server) Alter ¶
Alter handles requests to change the schema or remove parts or all of the data.
func (*Server) CheckVersion ¶
CheckVersion returns the version of this Dgraph instance.
func (*Server) CommitOrAbort ¶
func (s *Server) CommitOrAbort(ctx context.Context, tc *api.TxnContext) (*api.TxnContext, error)
CommitOrAbort commits or aborts a transaction.
func (*Server) CreateNamespaceInternal ¶
CreateNamespaceInternal creates a new namespace. Only superadmin is authorized to do so. Authorization is handled by middlewares.
func (*Server) DeleteNamespace ¶
DeleteNamespace deletes a new namespace. Only superadmin is authorized to do so. Authorization is handled by middlewares.
func (*Server) QueryGraphQL ¶
func (s *Server) QueryGraphQL(ctx context.Context, req *api.Request, field gqlSchema.Field) (*api.Response, error)
QueryGraphQL handles only GraphQL queries, neither mutations nor DQL.
func (*Server) QueryNoAuth ¶
func (*Server) QueryNoGrpc ¶
Query handles queries or mutations
func (*Server) ResetPassword ¶
func (s *Server) ResetPassword(ctx context.Context, inp *ResetPasswordInput) error
type ServerV25 ¶
type ServerV25 struct {
apiv2.UnimplementedDgraphServer
}
func (*ServerV25) AllocateIDs ¶
func (s *ServerV25) AllocateIDs(ctx context.Context, req *apiv2.AllocateIDsRequest) ( *apiv2.AllocateIDsResponse, error)
func (*ServerV25) Alter ¶
func (s *ServerV25) Alter(ctx context.Context, req *apiv2.AlterRequest) (*apiv2.AlterResponse, error)
Alter handles requests to change the schema or remove parts or all of the data.
func (*ServerV25) CreateNamespace ¶
func (s *ServerV25) CreateNamespace(ctx context.Context, in *apiv2.CreateNamespaceRequest) ( *apiv2.CreateNamespaceResponse, error)
func (*ServerV25) DropNamespace ¶
func (s *ServerV25) DropNamespace(ctx context.Context, in *apiv2.DropNamespaceRequest) ( *apiv2.DropNamespaceResponse, error)
func (*ServerV25) InitiatePDirStream ¶
func (s *ServerV25) InitiatePDirStream(ctx context.Context, c *apiv2.InitiatePDirStreamRequest) (v *apiv2.InitiatePDirStreamResponse, err error)
func (*ServerV25) ListNamespaces ¶
func (s *ServerV25) ListNamespaces(ctx context.Context, in *apiv2.ListNamespacesRequest) ( *apiv2.ListNamespacesResponse, error)
func (*ServerV25) Ping ¶
func (s *ServerV25) Ping(ctx context.Context, req *apiv2.PingRequest) (*apiv2.PingResponse, error)
func (*ServerV25) RunDQL ¶
func (s *ServerV25) RunDQL(ctx context.Context, req *apiv2.RunDQLRequest) (*apiv2.RunDQLResponse, error)
Alter handles requests to change the schema or remove parts or all of the data.
func (*ServerV25) SignInUser ¶
func (s *ServerV25) SignInUser(ctx context.Context, request *apiv2.SignInUserRequest) (*apiv2.SignInUserResponse, error)
func (*ServerV25) StreamPDir ¶
func (s *ServerV25) StreamPDir(stream apiv2.Dgraph_StreamPDirServer) error
func (*ServerV25) UpdateNamespace ¶
func (s *ServerV25) UpdateNamespace(ctx context.Context, in *apiv2.UpdateNamespaceRequest) ( *apiv2.UpdateNamespaceResponse, error)