Skip to content

Commit

Permalink
Merge pull request #109 from tri-adam/default-group-const
Browse files Browse the repository at this point in the history
Add Constant for Default Group
  • Loading branch information
tri-adam authored Aug 9, 2021
2 parents f1e0c3d + 76000d7 commit 9c920fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions pkg/sif/descriptor_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,23 +202,27 @@ type DescriptorInput struct {
opts descriptorOpts
}

// DefaultObjectGroup is the default group that data objects are placed in.
const DefaultObjectGroup = 1

// NewDescriptorInput returns a DescriptorInput representing a data object of type t, with contents
// read from r, configured according to opts.
//
// It is possible (and often necessary) to store additional metadata related to certain types of
// data objects. Consider supplying options such as OptCryptoMessageMetadata, OptPartitionMetadata,
// and OptSignatureMetadata for this purpose.
//
// By default, the data object will be placed in data object group 1. To override this behavior,
// use OptNoGroup or OptGroupID. To link this data object, use OptLinkedID or OptLinkedGroupID.
// By default, the data object will be placed in the default data object group (1). To override
// this behavior, use OptNoGroup or OptGroupID. To link this data object, use OptLinkedID or
// OptLinkedGroupID.
//
// By default, the data object will be aligned according to the system's memory page size. To
// override this behavior, consider using OptObjectAlignment.
//
// By default, no name is set for data object. To set a name, use OptObjectName.
func NewDescriptorInput(t DataType, r io.Reader, opts ...DescriptorInputOpt) (DescriptorInput, error) {
dopts := descriptorOpts{
groupID: 1,
groupID: DefaultObjectGroup,
alignment: os.Getpagesize(),
t: time.Now(),
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/sif/descriptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestDescriptor_GetName(t *testing.T) {

parts, err := f.GetDescriptors(
WithDataType(DataPartition),
WithGroupID(1),
WithGroupID(DefaultObjectGroup),
)
if err != nil {
t.Fatalf("failed to get descriptors: %v", err)
Expand Down

0 comments on commit 9c920fc

Please sign in to comment.