@@ -59,27 +59,12 @@ const (
59
59
UserAttr
60
60
)
61
61
62
- func serializeAttribute (a * eosclient.Attribute ) string {
63
- return fmt .Sprintf ("%s.%s=%s" , attrTypeToString (a .Type ), a .Key , a .Val )
64
- }
65
-
66
- func attrTypeToString (at eosclient.AttrType ) string {
67
- switch at {
68
- case eosclient .SystemAttr :
69
- return "sys"
70
- case eosclient .UserAttr :
71
- return "user"
72
- default :
73
- return "invalid"
74
- }
75
- }
76
-
77
- func isValidAttribute (a * eosclient.Attribute ) bool {
78
- // validate that an attribute is correct.
79
- if (a .Type != eosclient .SystemAttr && a .Type != eosclient .UserAttr ) || a .Key == "" {
80
- return false
81
- }
82
- return true
62
+ // Client performs actions against a EOS management node (MGM)
63
+ // using the EOS GRPC interface.
64
+ type Client struct {
65
+ opt * Options
66
+ httpcl * EOSHTTPClient
67
+ cl erpc.EosClient
83
68
}
84
69
85
70
// Options to configure the Client.
@@ -132,15 +117,6 @@ type Options struct {
132
117
TokenExpiry int
133
118
}
134
119
135
- func getUser (ctx context.Context ) (* userpb.User , error ) {
136
- u , ok := appctx .ContextGetUser (ctx )
137
- if ! ok {
138
- err := errors .Wrap (errtypes .UserRequired ("" ), "eosfs: error getting user from ctx" )
139
- return nil , err
140
- }
141
- return u , nil
142
- }
143
-
144
120
func (opt * Options ) init () {
145
121
if opt .XrdcopyBinary == "" {
146
122
opt .XrdcopyBinary = "/opt/eos/xrootd/bin/xrdcopy"
@@ -155,12 +131,36 @@ func (opt *Options) init() {
155
131
}
156
132
}
157
133
158
- // Client performs actions against a EOS management node (MGM)
159
- // using the EOS GRPC interface.
160
- type Client struct {
161
- opt * Options
162
- httpcl * EOSHTTPClient
163
- cl erpc.EosClient
134
+ func getUser (ctx context.Context ) (* userpb.User , error ) {
135
+ u , ok := appctx .ContextGetUser (ctx )
136
+ if ! ok {
137
+ err := errors .Wrap (errtypes .UserRequired ("" ), "eosfs: error getting user from ctx" )
138
+ return nil , err
139
+ }
140
+ return u , nil
141
+ }
142
+
143
+ func serializeAttribute (a * eosclient.Attribute ) string {
144
+ return fmt .Sprintf ("%s.%s=%s" , attrTypeToString (a .Type ), a .Key , a .Val )
145
+ }
146
+
147
+ func attrTypeToString (at eosclient.AttrType ) string {
148
+ switch at {
149
+ case eosclient .SystemAttr :
150
+ return "sys"
151
+ case eosclient .UserAttr :
152
+ return "user"
153
+ default :
154
+ return "invalid"
155
+ }
156
+ }
157
+
158
+ func isValidAttribute (a * eosclient.Attribute ) bool {
159
+ // validate that an attribute is correct.
160
+ if (a .Type != eosclient .SystemAttr && a .Type != eosclient .UserAttr ) || a .Key == "" {
161
+ return false
162
+ }
163
+ return true
164
164
}
165
165
166
166
// Create and connect a grpc eos Client.
0 commit comments