Documentation ¶
Overview ¶
Package shard is a dynamic storage backend that synthesizes a shard declaration.
Index ¶
Constants ¶
const ( ManifestType = "management" DeclarationType = "com.apple.management.properties" DeclarationIdentifier = "com.github.jessepeterson.kmfddm.storage.shard.v1" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶ added in v0.7.0
type Option func(*ShardStorage)
func WithShardFunc ¶ added in v0.7.0
WithShardFunc sets the shard function to f.
type ShardFunc ¶ added in v0.7.0
ShardFunc computes a shard value. A string of a decimal value between 0 and 100 inclusive should be returned. I.e. "42".
type ShardStorage ¶
type ShardStorage struct {
// contains filtered or unexported fields
}
ShardStorage is a dynamic storage backend that synthesizes a shard declaration. The declaration is a management properties declaration that sets the "shard" property to the shard number for the enrollment. This can then be used in activation predicates. The shard number is computed from the enrollment ID.
func NewShardStorage ¶
func NewShardStorage(opts ...Option) *ShardStorage
NewShardStorage creates a new shard storage. By default the shard function is hashed using FNV1Shard. Use WithShardFunc to change it.
func (*ShardStorage) RetrieveDeclarationItems ¶
func (s *ShardStorage) RetrieveDeclarationItems(_ context.Context, enrollmentID string) ([]*ddm.Declaration, error)
RetrieveDeclarationItems synthesizes a dynamic shard declaration. Used for injection into the declaration items and sync tokens.
func (*ShardStorage) RetrieveEnrollmentDeclarationJSON ¶
func (s *ShardStorage) RetrieveEnrollmentDeclarationJSON(_ context.Context, declarationID, declarationType, enrollmentID string) ([]byte, error)
RetrieveEnrollmentDeclarationJSON synthesizes a dynamic shard declaration.