Documentation ¶
Index ¶
- Variables
- func CreateDenseCARv2(dir, src string) (cid.Cid, string, error)
- func CreateRandomFile(dir string, rseed, size int) (string, error)
- func GenerateBlocksOfSize(n int, size int64) []blocks.Block
- func GenerateCid() cid.Cid
- func GenerateCids(n int) []cid.Cid
- func GeneratePeer() peer.ID
- func GeneratePeers(n int) []peer.ID
- func GetConn(r *http.Request) net.Conn
- func HttpTestDisconnectingServer(t *testing.T, dir string, afterEvery int64) *httptest.Server
- func HttpTestFileServer(t *testing.T, dir string) (*httptest.Server, error)
- func RandomBytes(n int64) []byte
- func SaveConnInContext(ctx context.Context, c net.Conn) context.Context
- func WriteUnixfsDAGTo(path string, into ipldformat.DAGService) (cid.Cid, error)
- type BlockingHttpTestServer
- type CarRes
- type HttpTestServer
- type SlowFileOpener
- type SlowReader
Constants ¶
This section is empty.
Variables ¶
var ConnContextKey = &contextKey{"http-conn"}
Functions ¶
func CreateDenseCARv2 ¶
CreateDenseCARv2 generates a "dense" UnixFS CARv2 from the supplied ordinary file. A dense UnixFS CARv2 is one storing leaf data. Contrast to CreateRefCARv2.
func CreateRandomFile ¶
CreateRandomFile
func GenerateBlocksOfSize ¶
GenerateBlocksOfSize generates a series of blocks of the given byte size
func GenerateCid ¶
func GenerateCid() cid.Cid
func GeneratePeer ¶
func HttpTestDisconnectingServer ¶
HttpTestDisconnectingServer returns a test http server that serves files from the given directory but disconnects after sending `afterEvery` bytes starting at the start offset mentioned in the Range request.
func HttpTestFileServer ¶
HttpTestFileServer returns a http server that serves files from the given directory with some latency
func RandomBytes ¶
RandomBytes returns a byte array of the given size with random values.
func WriteUnixfsDAGTo ¶
func WriteUnixfsDAGTo(path string, into ipldformat.DAGService) (cid.Cid, error)
Types ¶
type BlockingHttpTestServer ¶
type BlockingHttpTestServer struct { URL string // contains filtered or unexported fields }
BlockingHttpTestServer returns an http server that blocks for a given file until the client unblocks the serving of the file.
func NewBlockingHttpTestServer ¶
func NewBlockingHttpTestServer(t *testing.T, dir string) *BlockingHttpTestServer
func (*BlockingHttpTestServer) AddFile ¶
func (b *BlockingHttpTestServer) AddFile(name string)
func (*BlockingHttpTestServer) Close ¶
func (b *BlockingHttpTestServer) Close()
func (*BlockingHttpTestServer) Start ¶
func (b *BlockingHttpTestServer) Start()
func (*BlockingHttpTestServer) UnblockFile ¶
func (b *BlockingHttpTestServer) UnblockFile(name string)
type CarRes ¶
type CarRes struct { CarFile string OrigFile string Root cid.Cid Blockstore bstore.Blockstore CarSize uint64 }
type HttpTestServer ¶
func HttpTestUnstartedFileServer ¶
func HttpTestUnstartedFileServer(t *testing.T, dir string) *HttpTestServer
HttpTestUnstartedFileServer returns a http server that serves files from the given directory
func (*HttpTestServer) SetWorking ¶
func (s *HttpTestServer) SetWorking(working bool)
type SlowFileOpener ¶
type SlowFileOpener struct {
Dir string
}