func (suite *DynamicChunkStoreSuite) createChunkProvider(filler func(consumer chunk.Consumer)) chunk.Provider { store := serial.NewByteStore() consumer := dos.NewChunkConsumer(store) filler(consumer) consumer.Finish() provider, _ := dos.NewChunkProvider(bytes.NewReader(store.Data())) return provider }
func (suite *DynamicObjPropStoreSuite) createProvider(filler func(consumer objprop.Consumer)) objprop.Provider { store := serial.NewByteStore() consumer := dos.NewConsumer(store, suite.descriptors) filler(consumer) consumer.Finish() provider, _ := dos.NewProvider(bytes.NewReader(store.Data()), suite.descriptors) return provider }
func (suite *DynamicTextPropStoreSuite) createProvider(filler func(consumer textprop.Consumer)) textprop.Provider { store := serial.NewByteStore() consumer := dos.NewConsumer(store) filler(consumer) consumer.Finish() provider, _ := dos.NewProvider(bytes.NewReader(store.Data())) return provider }
func (library *ReleaseStoreLibrary) serializeChunkStore(store chunk.Store) []byte { buffer := serial.NewByteStore() consumer := dosChunk.NewChunkConsumer(buffer) ids := store.IDs() for _, id := range ids { blockStore := store.Get(id) consumer.Consume(id, blockStore) } consumer.Finish() return buffer.Data() }
func (library *ReleaseStoreLibrary) serializeObjpropStore(store objprop.Store) []byte { buffer := serial.NewByteStore() consumer := dosObjprop.NewConsumer(buffer, library.descriptors) for classIndex, classDesc := range library.descriptors { for subclassIndex, subclassDesc := range classDesc.Subclasses { for typeIndex := uint32(0); typeIndex < subclassDesc.TypeCount; typeIndex++ { objID := res.MakeObjectID(res.ObjectClass(classIndex), res.ObjectSubclass(subclassIndex), res.ObjectType(typeIndex)) data := store.Get(objID) consumer.Consume(objID, data) } } } consumer.Finish() return buffer.Data() }