コード例 #1
0
func (library *ReleaseStoreLibrary) openChunkStoreFrom(rel release.Release, name string) (chunkStore chunk.Store, err error) {
	resource, err := rel.GetResource(name)

	if err == nil {
		var reader serial.SeekingReadCloser
		reader, err = resource.AsSource()
		if err == nil {
			var provider chunk.Provider
			provider, err = dosChunk.NewChunkProvider(reader)
			if err == nil {
				chunkStore = library.createSavingChunkStore(provider, resource.Path(), name, func() { reader.Close() })
			}
		}
	}

	return
}
コード例 #2
0
func (library *ReleaseStoreLibrary) openObjpropStoreFrom(rel release.Release, name string) (objpropStore objprop.Store, err error) {
	resource, err := rel.GetResource(name)

	if err == nil {
		var reader serial.SeekingReadCloser
		reader, err = resource.AsSource()
		if err == nil {
			var provider objprop.Provider
			provider, err = dosObjprop.NewProvider(reader, library.descriptors)
			if err == nil {
				objpropStore = library.createSavingObjpropStore(provider, resource.Path(), name, func() { reader.Close() })
			}
		}
	}

	return
}