redis rpc服务, 提供redis操作方法
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

708 lines
20 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. // Code generated by protoc-gen-go.
  2. // source: redis.proto
  3. // DO NOT EDIT!
  4. /*
  5. Package redisrpc is a generated protocol buffer package.
  6. It is generated from these files:
  7. redis.proto
  8. It has these top-level messages:
  9. GetRequest
  10. SetRequest
  11. DelRequest
  12. HGetRequest
  13. HSetRequest
  14. HDelRequest
  15. SetExpireRequest
  16. GetStringResponse
  17. HGetListResponse
  18. SetResponse
  19. DelResponse
  20. HSetResponse
  21. SetExpireResponse
  22. SSetRequest
  23. SMembersRequest
  24. SSetResponse
  25. LSetRequest
  26. LSetResponse
  27. LRangeRequest
  28. LLenRequest
  29. AddRequest
  30. AddResponse
  31. */
  32. package redisrpc
  33. import proto "github.com/chai2010/protorpc/proto"
  34. import math "math"
  35. import "io"
  36. import "log"
  37. import "net"
  38. import "net/rpc"
  39. import "time"
  40. import protorpc "github.com/chai2010/protorpc"
  41. // Reference imports to suppress errors if they are not otherwise used.
  42. var _ = proto.Marshal
  43. var _ = math.Inf
  44. // 使用key查询
  45. type GetRequest struct {
  46. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  47. XXX_unrecognized []byte `json:"-"`
  48. }
  49. func (m *GetRequest) Reset() { *m = GetRequest{} }
  50. func (m *GetRequest) String() string { return proto.CompactTextString(m) }
  51. func (*GetRequest) ProtoMessage() {}
  52. func (m *GetRequest) GetKey() string {
  53. if m != nil && m.Key != nil {
  54. return *m.Key
  55. }
  56. return ""
  57. }
  58. // 设置key
  59. type SetRequest struct {
  60. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  61. Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
  62. Ttl *int64 `protobuf:"varint,3,opt,name=ttl" json:"ttl,omitempty"`
  63. XXX_unrecognized []byte `json:"-"`
  64. }
  65. func (m *SetRequest) Reset() { *m = SetRequest{} }
  66. func (m *SetRequest) String() string { return proto.CompactTextString(m) }
  67. func (*SetRequest) ProtoMessage() {}
  68. func (m *SetRequest) GetKey() string {
  69. if m != nil && m.Key != nil {
  70. return *m.Key
  71. }
  72. return ""
  73. }
  74. func (m *SetRequest) GetValue() string {
  75. if m != nil && m.Value != nil {
  76. return *m.Value
  77. }
  78. return ""
  79. }
  80. func (m *SetRequest) GetTtl() int64 {
  81. if m != nil && m.Ttl != nil {
  82. return *m.Ttl
  83. }
  84. return 0
  85. }
  86. type DelRequest struct {
  87. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  88. XXX_unrecognized []byte `json:"-"`
  89. }
  90. func (m *DelRequest) Reset() { *m = DelRequest{} }
  91. func (m *DelRequest) String() string { return proto.CompactTextString(m) }
  92. func (*DelRequest) ProtoMessage() {}
  93. func (m *DelRequest) GetKey() string {
  94. if m != nil && m.Key != nil {
  95. return *m.Key
  96. }
  97. return ""
  98. }
  99. // 使用hash key查询
  100. type HGetRequest struct {
  101. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  102. Field *string `protobuf:"bytes,2,opt,name=field" json:"field,omitempty"`
  103. XXX_unrecognized []byte `json:"-"`
  104. }
  105. func (m *HGetRequest) Reset() { *m = HGetRequest{} }
  106. func (m *HGetRequest) String() string { return proto.CompactTextString(m) }
  107. func (*HGetRequest) ProtoMessage() {}
  108. func (m *HGetRequest) GetKey() string {
  109. if m != nil && m.Key != nil {
  110. return *m.Key
  111. }
  112. return ""
  113. }
  114. func (m *HGetRequest) GetField() string {
  115. if m != nil && m.Field != nil {
  116. return *m.Field
  117. }
  118. return ""
  119. }
  120. // 设置hash key
  121. type HSetRequest struct {
  122. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  123. Field *string `protobuf:"bytes,2,opt,name=field" json:"field,omitempty"`
  124. Value *string `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"`
  125. XXX_unrecognized []byte `json:"-"`
  126. }
  127. func (m *HSetRequest) Reset() { *m = HSetRequest{} }
  128. func (m *HSetRequest) String() string { return proto.CompactTextString(m) }
  129. func (*HSetRequest) ProtoMessage() {}
  130. func (m *HSetRequest) GetKey() string {
  131. if m != nil && m.Key != nil {
  132. return *m.Key
  133. }
  134. return ""
  135. }
  136. func (m *HSetRequest) GetField() string {
  137. if m != nil && m.Field != nil {
  138. return *m.Field
  139. }
  140. return ""
  141. }
  142. func (m *HSetRequest) GetValue() string {
  143. if m != nil && m.Value != nil {
  144. return *m.Value
  145. }
  146. return ""
  147. }
  148. // 删除hash key
  149. type HDelRequest struct {
  150. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  151. Field *string `protobuf:"bytes,2,opt,name=field" json:"field,omitempty"`
  152. XXX_unrecognized []byte `json:"-"`
  153. }
  154. func (m *HDelRequest) Reset() { *m = HDelRequest{} }
  155. func (m *HDelRequest) String() string { return proto.CompactTextString(m) }
  156. func (*HDelRequest) ProtoMessage() {}
  157. func (m *HDelRequest) GetKey() string {
  158. if m != nil && m.Key != nil {
  159. return *m.Key
  160. }
  161. return ""
  162. }
  163. func (m *HDelRequest) GetField() string {
  164. if m != nil && m.Field != nil {
  165. return *m.Field
  166. }
  167. return ""
  168. }
  169. // 有效期
  170. type SetExpireRequest struct {
  171. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  172. Expire *int64 `protobuf:"varint,2,opt,name=expire" json:"expire,omitempty"`
  173. XXX_unrecognized []byte `json:"-"`
  174. }
  175. func (m *SetExpireRequest) Reset() { *m = SetExpireRequest{} }
  176. func (m *SetExpireRequest) String() string { return proto.CompactTextString(m) }
  177. func (*SetExpireRequest) ProtoMessage() {}
  178. func (m *SetExpireRequest) GetKey() string {
  179. if m != nil && m.Key != nil {
  180. return *m.Key
  181. }
  182. return ""
  183. }
  184. func (m *SetExpireRequest) GetExpire() int64 {
  185. if m != nil && m.Expire != nil {
  186. return *m.Expire
  187. }
  188. return 0
  189. }
  190. // 使用key查询响应结构
  191. type GetStringResponse struct {
  192. Value *string `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"`
  193. XXX_unrecognized []byte `json:"-"`
  194. }
  195. func (m *GetStringResponse) Reset() { *m = GetStringResponse{} }
  196. func (m *GetStringResponse) String() string { return proto.CompactTextString(m) }
  197. func (*GetStringResponse) ProtoMessage() {}
  198. func (m *GetStringResponse) GetValue() string {
  199. if m != nil && m.Value != nil {
  200. return *m.Value
  201. }
  202. return ""
  203. }
  204. // 使用key查询响应结构
  205. type HGetListResponse struct {
  206. List []byte `protobuf:"bytes,1,opt,name=list" json:"list,omitempty"`
  207. XXX_unrecognized []byte `json:"-"`
  208. }
  209. func (m *HGetListResponse) Reset() { *m = HGetListResponse{} }
  210. func (m *HGetListResponse) String() string { return proto.CompactTextString(m) }
  211. func (*HGetListResponse) ProtoMessage() {}
  212. func (m *HGetListResponse) GetList() []byte {
  213. if m != nil {
  214. return m.List
  215. }
  216. return nil
  217. }
  218. // 设置key响应结构
  219. type SetResponse struct {
  220. Ret *string `protobuf:"bytes,1,opt,name=ret" json:"ret,omitempty"`
  221. XXX_unrecognized []byte `json:"-"`
  222. }
  223. func (m *SetResponse) Reset() { *m = SetResponse{} }
  224. func (m *SetResponse) String() string { return proto.CompactTextString(m) }
  225. func (*SetResponse) ProtoMessage() {}
  226. func (m *SetResponse) GetRet() string {
  227. if m != nil && m.Ret != nil {
  228. return *m.Ret
  229. }
  230. return ""
  231. }
  232. // 删除key响应结构
  233. type DelResponse struct {
  234. Ret *int64 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"`
  235. XXX_unrecognized []byte `json:"-"`
  236. }
  237. func (m *DelResponse) Reset() { *m = DelResponse{} }
  238. func (m *DelResponse) String() string { return proto.CompactTextString(m) }
  239. func (*DelResponse) ProtoMessage() {}
  240. func (m *DelResponse) GetRet() int64 {
  241. if m != nil && m.Ret != nil {
  242. return *m.Ret
  243. }
  244. return 0
  245. }
  246. // 设置key响应结构
  247. type HSetResponse struct {
  248. Ret *int64 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"`
  249. XXX_unrecognized []byte `json:"-"`
  250. }
  251. func (m *HSetResponse) Reset() { *m = HSetResponse{} }
  252. func (m *HSetResponse) String() string { return proto.CompactTextString(m) }
  253. func (*HSetResponse) ProtoMessage() {}
  254. func (m *HSetResponse) GetRet() int64 {
  255. if m != nil && m.Ret != nil {
  256. return *m.Ret
  257. }
  258. return 0
  259. }
  260. // 设置key有效期
  261. type SetExpireResponse struct {
  262. Ret *int64 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"`
  263. XXX_unrecognized []byte `json:"-"`
  264. }
  265. func (m *SetExpireResponse) Reset() { *m = SetExpireResponse{} }
  266. func (m *SetExpireResponse) String() string { return proto.CompactTextString(m) }
  267. func (*SetExpireResponse) ProtoMessage() {}
  268. func (m *SetExpireResponse) GetRet() int64 {
  269. if m != nil && m.Ret != nil {
  270. return *m.Ret
  271. }
  272. return 0
  273. }
  274. // 集合添加值
  275. type SSetRequest struct {
  276. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  277. Field *string `protobuf:"bytes,2,opt,name=field" json:"field,omitempty"`
  278. XXX_unrecognized []byte `json:"-"`
  279. }
  280. func (m *SSetRequest) Reset() { *m = SSetRequest{} }
  281. func (m *SSetRequest) String() string { return proto.CompactTextString(m) }
  282. func (*SSetRequest) ProtoMessage() {}
  283. func (m *SSetRequest) GetKey() string {
  284. if m != nil && m.Key != nil {
  285. return *m.Key
  286. }
  287. return ""
  288. }
  289. func (m *SSetRequest) GetField() string {
  290. if m != nil && m.Field != nil {
  291. return *m.Field
  292. }
  293. return ""
  294. }
  295. // 集合添加值
  296. type SMembersRequest struct {
  297. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  298. XXX_unrecognized []byte `json:"-"`
  299. }
  300. func (m *SMembersRequest) Reset() { *m = SMembersRequest{} }
  301. func (m *SMembersRequest) String() string { return proto.CompactTextString(m) }
  302. func (*SMembersRequest) ProtoMessage() {}
  303. func (m *SMembersRequest) GetKey() string {
  304. if m != nil && m.Key != nil {
  305. return *m.Key
  306. }
  307. return ""
  308. }
  309. // 设置响应结构
  310. type SSetResponse struct {
  311. Ret *int64 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"`
  312. XXX_unrecognized []byte `json:"-"`
  313. }
  314. func (m *SSetResponse) Reset() { *m = SSetResponse{} }
  315. func (m *SSetResponse) String() string { return proto.CompactTextString(m) }
  316. func (*SSetResponse) ProtoMessage() {}
  317. func (m *SSetResponse) GetRet() int64 {
  318. if m != nil && m.Ret != nil {
  319. return *m.Ret
  320. }
  321. return 0
  322. }
  323. // 列表添加值
  324. type LSetRequest struct {
  325. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  326. Field *string `protobuf:"bytes,2,opt,name=field" json:"field,omitempty"`
  327. XXX_unrecognized []byte `json:"-"`
  328. }
  329. func (m *LSetRequest) Reset() { *m = LSetRequest{} }
  330. func (m *LSetRequest) String() string { return proto.CompactTextString(m) }
  331. func (*LSetRequest) ProtoMessage() {}
  332. func (m *LSetRequest) GetKey() string {
  333. if m != nil && m.Key != nil {
  334. return *m.Key
  335. }
  336. return ""
  337. }
  338. func (m *LSetRequest) GetField() string {
  339. if m != nil && m.Field != nil {
  340. return *m.Field
  341. }
  342. return ""
  343. }
  344. // 设置key响应结构
  345. type LSetResponse struct {
  346. Ret *int64 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"`
  347. XXX_unrecognized []byte `json:"-"`
  348. }
  349. func (m *LSetResponse) Reset() { *m = LSetResponse{} }
  350. func (m *LSetResponse) String() string { return proto.CompactTextString(m) }
  351. func (*LSetResponse) ProtoMessage() {}
  352. func (m *LSetResponse) GetRet() int64 {
  353. if m != nil && m.Ret != nil {
  354. return *m.Ret
  355. }
  356. return 0
  357. }
  358. // 列表取值
  359. type LRangeRequest struct {
  360. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  361. Start *int64 `protobuf:"varint,2,opt,name=start" json:"start,omitempty"`
  362. Stop *int64 `protobuf:"varint,3,opt,name=stop" json:"stop,omitempty"`
  363. XXX_unrecognized []byte `json:"-"`
  364. }
  365. func (m *LRangeRequest) Reset() { *m = LRangeRequest{} }
  366. func (m *LRangeRequest) String() string { return proto.CompactTextString(m) }
  367. func (*LRangeRequest) ProtoMessage() {}
  368. func (m *LRangeRequest) GetKey() string {
  369. if m != nil && m.Key != nil {
  370. return *m.Key
  371. }
  372. return ""
  373. }
  374. func (m *LRangeRequest) GetStart() int64 {
  375. if m != nil && m.Start != nil {
  376. return *m.Start
  377. }
  378. return 0
  379. }
  380. func (m *LRangeRequest) GetStop() int64 {
  381. if m != nil && m.Stop != nil {
  382. return *m.Stop
  383. }
  384. return 0
  385. }
  386. // 列表长度
  387. type LLenRequest struct {
  388. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  389. XXX_unrecognized []byte `json:"-"`
  390. }
  391. func (m *LLenRequest) Reset() { *m = LLenRequest{} }
  392. func (m *LLenRequest) String() string { return proto.CompactTextString(m) }
  393. func (*LLenRequest) ProtoMessage() {}
  394. func (m *LLenRequest) GetKey() string {
  395. if m != nil && m.Key != nil {
  396. return *m.Key
  397. }
  398. return ""
  399. }
  400. // 数值增加
  401. type AddRequest struct {
  402. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  403. Value *int64 `protobuf:"varint,2,opt,name=value" json:"value,omitempty"`
  404. XXX_unrecognized []byte `json:"-"`
  405. }
  406. func (m *AddRequest) Reset() { *m = AddRequest{} }
  407. func (m *AddRequest) String() string { return proto.CompactTextString(m) }
  408. func (*AddRequest) ProtoMessage() {}
  409. func (m *AddRequest) GetKey() string {
  410. if m != nil && m.Key != nil {
  411. return *m.Key
  412. }
  413. return ""
  414. }
  415. func (m *AddRequest) GetValue() int64 {
  416. if m != nil && m.Value != nil {
  417. return *m.Value
  418. }
  419. return 0
  420. }
  421. type AddResponse struct {
  422. Ret *int64 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"`
  423. XXX_unrecognized []byte `json:"-"`
  424. }
  425. func (m *AddResponse) Reset() { *m = AddResponse{} }
  426. func (m *AddResponse) String() string { return proto.CompactTextString(m) }
  427. func (*AddResponse) ProtoMessage() {}
  428. func (m *AddResponse) GetRet() int64 {
  429. if m != nil && m.Ret != nil {
  430. return *m.Ret
  431. }
  432. return 0
  433. }
  434. func init() {
  435. }
  436. type RedisService interface {
  437. Get(in *GetRequest, out *GetStringResponse) error
  438. Set(in *SetRequest, out *SetResponse) error
  439. SetNx(in *SetRequest, out *DelResponse) error
  440. Del(in *DelRequest, out *DelResponse) error
  441. HGet(in *HGetRequest, out *GetStringResponse) error
  442. HSet(in *HSetRequest, out *HSetResponse) error
  443. HDel(in *HDelRequest, out *DelResponse) error
  444. SetExpire(in *SetExpireRequest, out *SetExpireResponse) error
  445. HGetAll(in *GetRequest, out *HGetListResponse) error
  446. HGetList(in *GetRequest, out *HGetListResponse) error
  447. HExists(in *HGetRequest, out *DelResponse) error
  448. Exists(in *GetRequest, out *DelResponse) error
  449. HIncrby(in *HSetRequest, out *HSetResponse) error
  450. SAdd(in *SSetRequest, out *SSetResponse) error
  451. SIsmember(in *SSetRequest, out *SSetResponse) error
  452. SRem(in *SSetRequest, out *SSetResponse) error
  453. SCard(in *SMembersRequest, out *SSetResponse) error
  454. LLpush(in *LSetRequest, out *LSetResponse) error
  455. LRpush(in *LSetRequest, out *LSetResponse) error
  456. LRange(in *LRangeRequest, out *HGetListResponse) error
  457. LLen(in *LLenRequest, out *LSetResponse) error
  458. ReduceStock(in *SetRequest, out *SetResponse) error
  459. Incrby(in *AddRequest, out *AddResponse) error
  460. Decrby(in *AddRequest, out *AddResponse) error
  461. }
  462. // AcceptRedisServiceClient accepts connections on the listener and serves requests
  463. // for each incoming connection. Accept blocks; the caller typically
  464. // invokes it in a go statement.
  465. func AcceptRedisServiceClient(lis net.Listener, x RedisService) {
  466. srv := rpc.NewServer()
  467. if err := srv.RegisterName("RedisService", x); err != nil {
  468. log.Fatal(err)
  469. }
  470. for {
  471. conn, err := lis.Accept()
  472. if err != nil {
  473. log.Fatalf("lis.Accept(): %v\n", err)
  474. }
  475. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  476. }
  477. }
  478. // RegisterRedisService publish the given RedisService implementation on the server.
  479. func RegisterRedisService(srv *rpc.Server, x RedisService) error {
  480. if err := srv.RegisterName("RedisService", x); err != nil {
  481. return err
  482. }
  483. return nil
  484. }
  485. // NewRedisServiceServer returns a new RedisService Server.
  486. func NewRedisServiceServer(x RedisService) *rpc.Server {
  487. srv := rpc.NewServer()
  488. if err := srv.RegisterName("RedisService", x); err != nil {
  489. log.Fatal(err)
  490. }
  491. return srv
  492. }
  493. // ListenAndServeRedisService listen announces on the local network address laddr
  494. // and serves the given RedisService implementation.
  495. func ListenAndServeRedisService(network, addr string, x RedisService) error {
  496. lis, err := net.Listen(network, addr)
  497. if err != nil {
  498. return err
  499. }
  500. defer lis.Close()
  501. srv := rpc.NewServer()
  502. if err := srv.RegisterName("RedisService", x); err != nil {
  503. return err
  504. }
  505. for {
  506. conn, err := lis.Accept()
  507. if err != nil {
  508. log.Fatalf("lis.Accept(): %v\n", err)
  509. }
  510. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  511. }
  512. }
  513. type RedisServiceClient struct {
  514. *rpc.Client
  515. }
  516. // NewRedisServiceClient returns a RedisService rpc.Client and stub to handle
  517. // requests to the set of RedisService at the other end of the connection.
  518. func NewRedisServiceClient(conn io.ReadWriteCloser) (*RedisServiceClient, *rpc.Client) {
  519. c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
  520. return &RedisServiceClient{c}, c
  521. }
  522. func (c *RedisServiceClient) Get(in *GetRequest, out *GetStringResponse) error {
  523. return c.Call("RedisService.Get", in, out)
  524. }
  525. func (c *RedisServiceClient) Set(in *SetRequest, out *SetResponse) error {
  526. return c.Call("RedisService.Set", in, out)
  527. }
  528. func (c *RedisServiceClient) SetNx(in *SetRequest, out *DelResponse) error {
  529. return c.Call("RedisService.SetNx", in, out)
  530. }
  531. func (c *RedisServiceClient) Del(in *DelRequest, out *DelResponse) error {
  532. return c.Call("RedisService.Del", in, out)
  533. }
  534. func (c *RedisServiceClient) HGet(in *HGetRequest, out *GetStringResponse) error {
  535. return c.Call("RedisService.HGet", in, out)
  536. }
  537. func (c *RedisServiceClient) HSet(in *HSetRequest, out *HSetResponse) error {
  538. return c.Call("RedisService.HSet", in, out)
  539. }
  540. func (c *RedisServiceClient) HDel(in *HDelRequest, out *DelResponse) error {
  541. return c.Call("RedisService.HDel", in, out)
  542. }
  543. func (c *RedisServiceClient) SetExpire(in *SetExpireRequest, out *SetExpireResponse) error {
  544. return c.Call("RedisService.SetExpire", in, out)
  545. }
  546. func (c *RedisServiceClient) HGetAll(in *GetRequest, out *HGetListResponse) error {
  547. return c.Call("RedisService.HGetAll", in, out)
  548. }
  549. func (c *RedisServiceClient) HGetList(in *GetRequest, out *HGetListResponse) error {
  550. return c.Call("RedisService.HGetList", in, out)
  551. }
  552. func (c *RedisServiceClient) HExists(in *HGetRequest, out *DelResponse) error {
  553. return c.Call("RedisService.HExists", in, out)
  554. }
  555. func (c *RedisServiceClient) Exists(in *GetRequest, out *DelResponse) error {
  556. return c.Call("RedisService.Exists", in, out)
  557. }
  558. func (c *RedisServiceClient) HIncrby(in *HSetRequest, out *HSetResponse) error {
  559. return c.Call("RedisService.HIncrby", in, out)
  560. }
  561. func (c *RedisServiceClient) SAdd(in *SSetRequest, out *SSetResponse) error {
  562. return c.Call("RedisService.SAdd", in, out)
  563. }
  564. func (c *RedisServiceClient) SIsmember(in *SSetRequest, out *SSetResponse) error {
  565. return c.Call("RedisService.SIsmember", in, out)
  566. }
  567. func (c *RedisServiceClient) SRem(in *SSetRequest, out *SSetResponse) error {
  568. return c.Call("RedisService.SRem", in, out)
  569. }
  570. func (c *RedisServiceClient) SCard(in *SMembersRequest, out *SSetResponse) error {
  571. return c.Call("RedisService.SCard", in, out)
  572. }
  573. func (c *RedisServiceClient) LLpush(in *LSetRequest, out *LSetResponse) error {
  574. return c.Call("RedisService.LLpush", in, out)
  575. }
  576. func (c *RedisServiceClient) LRpush(in *LSetRequest, out *LSetResponse) error {
  577. return c.Call("RedisService.LRpush", in, out)
  578. }
  579. func (c *RedisServiceClient) LRange(in *LRangeRequest, out *HGetListResponse) error {
  580. return c.Call("RedisService.LRange", in, out)
  581. }
  582. func (c *RedisServiceClient) LLen(in *LLenRequest, out *LSetResponse) error {
  583. return c.Call("RedisService.LLen", in, out)
  584. }
  585. func (c *RedisServiceClient) ReduceStock(in *SetRequest, out *SetResponse) error {
  586. return c.Call("RedisService.ReduceStock", in, out)
  587. }
  588. func (c *RedisServiceClient) Incrby(in *AddRequest, out *AddResponse) error {
  589. return c.Call("RedisService.Incrby", in, out)
  590. }
  591. func (c *RedisServiceClient) Decrby(in *AddRequest, out *AddResponse) error {
  592. return c.Call("RedisService.Decrby", in, out)
  593. }
  594. // DialRedisService connects to an RedisService at the specified network address.
  595. func DialRedisService(network, addr string) (*RedisServiceClient, *rpc.Client, error) {
  596. c, err := protorpc.Dial(network, addr)
  597. if err != nil {
  598. return nil, nil, err
  599. }
  600. return &RedisServiceClient{c}, c, nil
  601. }
  602. // DialRedisServiceTimeout connects to an RedisService at the specified network address.
  603. func DialRedisServiceTimeout(network, addr string,
  604. timeout time.Duration) (*RedisServiceClient, *rpc.Client, error) {
  605. c, err := protorpc.DialTimeout(network, addr, timeout)
  606. if err != nil {
  607. return nil, nil, err
  608. }
  609. return &RedisServiceClient{c}, c, nil
  610. }