This repository was archived by the owner on Mar 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathasdf.go
More file actions
47 lines (40 loc) · 1.33 KB
/
asdf.go
File metadata and controls
47 lines (40 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2015 The astrogo Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package asdf
import (
"github.com/astrogo/asdf/schemas/stsci.edu/asdf/core"
)
var (
blockMagicToken = []byte("\323BLK")
blockIndex = []byte("#ASDF BLOCK INDEX")
)
// File holds informations about an ASDF file
type File struct {
Version string // low-level file format version
Comments []string
Tree *Tree
Blocks []Block
Index []uint64
}
// Tree holds structured informations and meta-data
type Tree struct {
//data map[string]interface{}
data core.ASDF
}
// Block represents a contiguous chunk of binary data in an ASDF file
type Block struct {
Header Header
Data []byte
}
// Header holds informations a Block
type Header struct {
Magic [4]byte // block magic token ("\323BLK")
Size uint16 // size of the remainder of the header (not counting Magic nor Size)
Flags uint32
Compression [4]byte
AllocSize uint64 // amount of space allocated for the block (not including the header), in bytes
UsedSize uint64 // amount of used space for the block on disk (not including the header), in bytes
DataSize uint64 // size of the block when decoded, in bytes
Checksum [16]byte // MD5 checksum of the used data in the block
}