MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestMetaFile_WriteMeta

Function TestMetaFile_WriteMeta

internal/utils/bfs/meta_file_test.go:97–133  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

95}
96
97func TestMetaFile_WriteMeta(t *testing.T) {
98 mFile, err := bfs.OpenMetaFile("testdata/test.m", &sync.RWMutex{})
99 if err != nil {
100 t.Fatal(err)
101 }
102 defer func() {
103 _ = mFile.Close()
104 }()
105
106 var hash = bfs.Hash("123456")
107 err = mFile.WriteMeta(hash, 200, fasttime.Now().Unix()+3600, -1)
108 if err != nil {
109 t.Fatal(err)
110 }
111
112 err = mFile.WriteHeaderBlockUnsafe(hash, 123, 223)
113 if err != nil {
114 t.Fatal(err)
115 }
116
117 err = mFile.WriteBodyBlockUnsafe(hash, 223, 323, 0, 100)
118 if err != nil {
119 t.Fatal(err)
120 }
121
122 err = mFile.WriteBodyBlockUnsafe(hash, 323, 423, 100, 200)
123 if err != nil {
124 t.Fatal(err)
125 }
126
127 err = mFile.WriteClose(hash, 100, 200)
128 if err != nil {
129 t.Fatal(err)
130 }
131
132 //logs.PrintAsJSON(mFile.Header(hash), t)
133}
134
135func TestMetaFile_Write(t *testing.T) {
136 mFile, err := bfs.OpenMetaFile("testdata/test.m", &sync.RWMutex{})

Callers

nothing calls this directly

Calls 9

OpenMetaFileFunction · 0.92
HashFunction · 0.92
NowFunction · 0.92
UnixMethod · 0.80
WriteBodyBlockUnsafeMethod · 0.80
WriteCloseMethod · 0.80
CloseMethod · 0.65
WriteMetaMethod · 0.45

Tested by

no test coverage detected