package transformer import ( "context" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" ) type chanTarget struct { ch chan<- *objectSDK.Object } // NewChannelTarget returns ObjectTarget which writes // object parts to a provided channel. func NewChannelTarget(ch chan<- *objectSDK.Object) ObjectWriter { return &chanTarget{ ch: ch, } } func (c *chanTarget) WriteObject(ctx context.Context, o *objectSDK.Object) error { select { case c.ch <- o: case <-ctx.Done(): return ctx.Err() } return nil }