git.frostfs.info/TrueCloudLab/frostfs-sdk-go@v0.0.0-20241022124111-5361f0ecebd3/pool/doc.go (about) 1 /* 2 Package pool provides a wrapper for several FrostFS API clients. 3 4 The main component is Pool type. It is a virtual connection to the network 5 and provides methods for executing operations on the server. It also supports 6 a weighted random selection of the underlying client to make requests. 7 8 Create pool instance with 3 nodes connection. 9 This InitParameters will make pool use 192.168.130.71 node while it is healthy. Otherwise, it will make the pool use 10 192.168.130.72 for 90% of requests and 192.168.130.73 for remaining 10%: 11 12 var prm pool.InitParameters 13 prm.SetKey(key) 14 prm.AddNode(NewNodeParam(1, "192.168.130.71", 1)) 15 prm.AddNode(NewNodeParam(2, "192.168.130.72", 9)) 16 prm.AddNode(NewNodeParam(2, "192.168.130.73", 1)) 17 // ... 18 19 p, err := pool.NewPool(prm) 20 // ... 21 22 Connect to the FrostFS server: 23 24 err := p.Dial(ctx) 25 // ... 26 27 Execute FrostFS operation on the server: 28 29 var prm pool.PrmContainerPut 30 prm.SetContainer(cnr) 31 // ... 32 33 res, err := p.PutContainer(context.Background(), prm) 34 // ... 35 36 Execute FrostFS operation on the server and check error: 37 38 var prm pool.PrmObjectHead 39 prm.SetAddress(addr) 40 // ... 41 42 res, err := p.HeadObject(context.Background(), prm) 43 if client.IsErrObjectNotFound(err) { 44 // ... 45 } 46 // ... 47 48 Close the connection: 49 50 p.Close() 51 */ 52 package pool