Documentation
¶
Index ¶
- Constants
- func CheckAndModifyPreDefPredicate(update *pb.SchemaUpdate) bool
- func CompleteInitialSchema(namespace uint64) []*pb.SchemaUpdate
- func CompleteInitialTypes(namespace uint64) []*pb.TypeUpdate
- func GetIndexingPredicates() []string
- func GetWriteContext(ctx context.Context) context.Context
- func HasTokenizerOrVectorIndexSpec(update *pb.SchemaUpdate) bool
- func Init(ps *badger.DB)
- func InitialSchema(namespace uint64) []*pb.SchemaUpdate
- func InitialTypes(namespace uint64) []*pb.TypeUpdate
- func IsPreDefTypeChanged(update *pb.TypeUpdate) bool
- func Load(predicate string) error
- func LoadFromDb(ctx context.Context) error
- func ParseBytes(s []byte, gid uint32) (rerr error)
- func State() *state
- type ParsedSchema
Constants ¶
const ( IsWrite contextKey = iota IsUniqueDgraphXid = true )
Variables ¶
This section is empty.
Functions ¶
func CheckAndModifyPreDefPredicate ¶
func CheckAndModifyPreDefPredicate(update *pb.SchemaUpdate) bool
CheckAndModifyPreDefPredicate returns true if the initial update for the pre-defined predicate is different from the passed update. It may also modify certain predicates under specific conditions. If the passed update is not a pre-defined predicate, it returns false.
func CompleteInitialSchema ¶
func CompleteInitialSchema(namespace uint64) []*pb.SchemaUpdate
CompleteInitialSchema returns all the schema updates regardless of the worker options. This is useful in situations where the worker options are not known in advance and it's better to create all the reserved predicates and remove them later than miss some of them. An example of such situation is during bulk loading.
func CompleteInitialTypes ¶
func CompleteInitialTypes(namespace uint64) []*pb.TypeUpdate
CompleteInitialTypes returns all the type updates regardless of the worker options. This is useful in situations where the worker options are not known in advance or it is required to consider all initial pre-defined types. An example of such situation is while allowing type updates to go through during alter if they are same as existing pre-defined types. This is useful for live loading a previously exported schema.
func GetIndexingPredicates ¶
func GetIndexingPredicates() []string
GetIndexingPredicates returns the list of predicates for which we are building indexes.
func GetWriteContext ¶
GetWriteContext returns a context that sets the schema context for writing.
func HasTokenizerOrVectorIndexSpec ¶
func HasTokenizerOrVectorIndexSpec(update *pb.SchemaUpdate) bool
func Init ¶
func Init(ps *badger.DB)
Init resets the schema state, setting the underlying DB to the given pointer.
func InitialSchema ¶
func InitialSchema(namespace uint64) []*pb.SchemaUpdate
InitialSchema returns the schema updates to insert at the beginning of Dgraph's execution. It looks at the worker options to determine which attributes to insert.
func InitialTypes ¶
func InitialTypes(namespace uint64) []*pb.TypeUpdate
InitialTypes returns the type updates to insert at the beginning of Dgraph's execution. It looks at the worker options to determine which types to insert.
func IsPreDefTypeChanged ¶
func IsPreDefTypeChanged(update *pb.TypeUpdate) bool
IsPreDefTypeChanged returns true if the initial update for the pre-defined type is different than the passed update. If the passed update is not a pre-defined type than it just returns false.
func LoadFromDb ¶
LoadFromDb reads schema information from db and stores it in memory
func ParseBytes ¶
ParseBytes parses the byte array which holds the schema. We will reset all the globals. Overwrites schema blindly - called only during initilization in testing
Types ¶
type ParsedSchema ¶
type ParsedSchema struct {
Preds []*pb.SchemaUpdate
Types []*pb.TypeUpdate
}
ParsedSchema represents the parsed schema and type updates.
func Parse ¶
func Parse(s string) (*ParsedSchema, error)
Parse parses the schema with namespace preserved. For the types/predicates for which the namespace is not specified, it uses default.
func ParseWithNamespace ¶
func ParseWithNamespace(s string, namespace uint64) (*ParsedSchema, error)
ParseWithNamespace parses the schema and forces the given namespace on each of the type/predicate.