hancock

Check-in [6df3601824]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:create manifest from io.Reader
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6df360182499c912aa1a008a92f147f8e63e07eab33c1c9b752e898a73582c2c
User & Date: dnc 2019-09-26 14:27:05
Context
2019-09-26
14:28
minor changes to variable names check-in: ff157b9a48 user: dnc tags: trunk
14:27
create manifest from io.Reader check-in: 6df3601824 user: dnc tags: trunk
14:26
add check that authority public key is set check-in: 77d3d4e49a user: dnc tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to model/manifest.go.

112
113
114
115
116
117
118



119




120
121
122
123
124
125
126
127
128
129
130
131
132
133
134

func NewFileManifest(path string) (*FileManifest, error) {
	f, err := os.Open(path)
	if err != nil {
		return nil, err
	}
	defer f.Close()








	cid := NewSha256CID(nil)
	_, err = io.Copy(cid, f)
	if err != nil {
		return nil, err
	}

	return &FileManifest{
		Path: path,
		Time: time.Now().Unix(),
		CID:  cid.Encode(),
	}, nil
}

// Enforce limitations on manifest data.
func (this FileManifest) Check() error {







>
>
>
|
>
>
>
>

|





<







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133

134
135
136
137
138
139
140

func NewFileManifest(path string) (*FileManifest, error) {
	f, err := os.Open(path)
	if err != nil {
		return nil, err
	}
	defer f.Close()
	man, err := NewManifest(f)
	if err != nil {
		return nil, err
	}
	man.Path = path
	return man, err
}
func NewManifest(f io.Reader) (*FileManifest, error) {
	cid := NewSha256CID(nil)
	_, err := io.Copy(cid, f)
	if err != nil {
		return nil, err
	}

	return &FileManifest{

		Time: time.Now().Unix(),
		CID:  cid.Encode(),
	}, nil
}

// Enforce limitations on manifest data.
func (this FileManifest) Check() error {