MCPcopy
hub / github.com/minio/minio-go / run

Function run

cmd/rdma-test/main.go:44–118  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42}
43
44func run() error {
45 endpoint := envOr("MINIO_ENDPOINT", "coe01:9000")
46 accessKey := envOr("MINIO_ACCESS_KEY", "minioadmin")
47 secretKey := envOr("MINIO_SECRET_KEY", "minioadmin")
48
49 fmt.Printf("endpoint=%s rdma_available=%v\n", endpoint, minio.IsRDMAAvailable())
50
51 client, err := minio.New(endpoint, &minio.Options{
52 Creds: credentials.NewStaticV4(accessKey, secretKey, ""),
53 Secure: false,
54 EnableRDMA: true,
55 })
56 if err != nil {
57 return fmt.Errorf("New: %w", err)
58 }
59
60 ctx := context.Background()
61
62 exists, err := client.BucketExists(ctx, testBucket)
63 if err != nil {
64 return fmt.Errorf("BucketExists: %w", err)
65 }
66 if !exists {
67 if err := client.MakeBucket(ctx, testBucket, minio.MakeBucketOptions{}); err != nil {
68 return fmt.Errorf("MakeBucket: %w", err)
69 }
70 }
71
72 src := minio.AlignedBuffer(testSize)
73 if src == nil {
74 return fmt.Errorf("AlignedBuffer(%d) returned nil", testSize)
75 }
76 defer minio.FreeAlignedBuffer(src)
77 srcSlice := unsafe.Slice((*byte)(src), testSize)
78 for i := range srcSlice {
79 srcSlice[i] = byte(i)
80 }
81
82 fmt.Print("PutObject (RDMA)... ")
83 info, err := client.PutObject(ctx, testBucket, testObject, nil, 0, minio.PutObjectOptions{
84 RDMABuffer: src,
85 RDMABufferSize: testSize,
86 })
87 if err != nil {
88 return fmt.Errorf("PutObject: %w", err)
89 }
90 fmt.Printf("ok etag=%s size=%d checksum=%s\n", info.ETag, info.Size, info.ChecksumCRC64NVME)
91
92 dst := minio.AlignedBuffer(testSize)
93 if dst == nil {
94 return fmt.Errorf("AlignedBuffer(%d) returned nil", testSize)
95 }
96 defer minio.FreeAlignedBuffer(dst)
97 dstSlice := unsafe.Slice((*byte)(dst), testSize)
98
99 fmt.Print("GetObject (RDMA)... ")
100 obj, err := client.GetObject(ctx, testBucket, testObject, minio.GetObjectOptions{
101 RDMABuffer: dst,

Callers 1

mainFunction · 0.85

Calls 8

NewStaticV4Function · 0.92
envOrFunction · 0.85
BucketExistsMethod · 0.80
MakeBucketMethod · 0.80
StatMethod · 0.80
EqualMethod · 0.80
PutObjectMethod · 0.45
GetObjectMethod · 0.45

Tested by

no test coverage detected