Skip to content

Commit 759a848

Browse files
author
maksim.konovalov
committed
move box.Info to box.go
1 parent a5634b6 commit 759a848

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

box/box.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,21 @@ func By(conn tarantool.Doer) Box {
2222
conn: conn, // Assigns the provided Tarantool connection.
2323
}
2424
}
25+
26+
// Info retrieves the current information of the Tarantool instance.
27+
// It calls the "box.info" function and parses the result into the Info structure.
28+
func (b *box) Info() (Info, error) {
29+
var infoResp InfoResponse
30+
31+
// Call "box.info" to get instance information from Tarantool.
32+
fut := b.conn.Do(NewInfoRequest())
33+
34+
// Parse the result into the Info structure.
35+
err := fut.GetTyped(&infoResp)
36+
if err != nil {
37+
return Info{}, err
38+
}
39+
40+
// Return the parsed info and any potential error.
41+
return infoResp.Info, err
42+
}

box/info.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,6 @@ func (ir *InfoResponse) DecodeMsgpack(d *msgpack.Decoder) error {
5656
return nil
5757
}
5858

59-
// Info retrieves the current information of the Tarantool instance.
60-
// It calls the "box.info" function and parses the result into the Info structure.
61-
func (b *box) Info() (Info, error) {
62-
var infoResp InfoResponse
63-
64-
// Call "box.info" to get instance information from Tarantool.
65-
fut := b.conn.Do(NewInfoRequest())
66-
67-
// Parse the result into the Info structure.
68-
err := fut.GetTyped(&infoResp)
69-
if err != nil {
70-
return Info{}, err
71-
}
72-
73-
// Return the parsed info and any potential error.
74-
return infoResp.Info, err
75-
}
76-
7759
// InfoRequest represents a request to retrieve information about the Tarantool instance.
7860
// It implements the tarantool.Request interface.
7961
type InfoRequest struct {

0 commit comments

Comments
 (0)