github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2013/oscon-dl/chunkaligned.go (about)

     1  // +build ignore,OMIT
     2  
     3  package main
     4  
     5  import "io"
     6  
     7  type SizeReaderAt interface {
     8  	io.ReaderAt
     9  	Size() int64
    10  }
    11  
    12  // START_DOC OMIT
    13  // NewChunkAlignedReaderAt returns a ReaderAt wrapper that is backed
    14  // by a ReaderAt r of size totalSize where the wrapper guarantees that
    15  // all ReadAt calls are aligned to chunkSize boundaries and of size
    16  // chunkSize (except for the final chunk, which may be shorter).
    17  //
    18  // A chunk-aligned reader is good for caching, letting upper layers have
    19  // any access pattern, but guarantees that the wrapped ReaderAt sees
    20  // only nicely-cacheable access patterns & sizes.
    21  func NewChunkAlignedReaderAt(r SizeReaderAt, chunkSize int) SizeReaderAt {
    22  	// ...
    23  	return nil // OMIT
    24  }
    25  
    26  // END_DOC OMIT