MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / Format

Method Format

internal/users/index.go:469–476  ·  view source on GitHub ↗

Format formats the metadata header as a fixed-width string. The header (without newline) is exactly 99 bytes.

()

Source from the content-addressed store, hash-verified

467// Format formats the metadata header as a fixed-width string.
468// The header (without newline) is exactly 99 bytes.
469func (m IndexMetaData) Format() ([]byte, error) {
470 headerContent := fmt.Sprintf("VERSION=%d,RECORDCOUNT=%d,RECORDSIZE=%d,CHECKSUM=%d", m.IndexVersion, m.RecordCount, m.RecordSize, m.Checksum)
471 if len(headerContent) > FixedHeaderTotalLength-1 {
472 return nil, fmt.Errorf("header content too long: %d bytes", len(headerContent))
473 }
474 padded := headerContent + strings.Repeat(" ", FixedHeaderTotalLength-1-len(headerContent))
475 return []byte(padded + string(IndexLineTerminatorV1)), nil
476}
477
478// writeCompleteIndex writes metadata and all records atomically via temp file + rename.
479func (idx *UserIndex) writeCompleteIndex(records []IndexUserRecord) error {

Callers 15

sendGamePayloadMethod · 0.80
onJoinLeaveMethod · 0.80
DateStringMethod · 0.80
toSummaryEntryFunction · 0.80
toAdminEntryFunction · 0.80
auctionCommandMethod · 0.80
CreateMethod · 0.80
writeChecksumMethod · 0.80
AddUserMethod · 0.80
writeCompleteIndexMethod · 0.80
trackFullFunction · 0.80
BackupFilenameFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected