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.

704 lines
20 KiB

3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 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. LLpush(in *LSetRequest, out *LSetResponse) error
  454. LRpush(in *LSetRequest, out *LSetResponse) error
  455. LRange(in *LRangeRequest, out *HGetListResponse) error
  456. LLen(in *LLenRequest, out *LSetResponse) error
  457. ReduceStock(in *SetRequest, out *SetResponse) error
  458. Incrby(in *AddRequest, out *AddResponse) error
  459. Decrby(in *AddRequest, out *AddResponse) error
  460. }
  461. // AcceptRedisServiceClient accepts connections on the listener and serves requests
  462. // for each incoming connection. Accept blocks; the caller typically
  463. // invokes it in a go statement.
  464. func AcceptRedisServiceClient(lis net.Listener, x RedisService) {
  465. srv := rpc.NewServer()
  466. if err := srv.RegisterName("RedisService", x); err != nil {
  467. log.Fatal(err)
  468. }
  469. for {
  470. conn, err := lis.Accept()
  471. if err != nil {
  472. log.Fatalf("lis.Accept(): %v\n", err)
  473. }
  474. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  475. }
  476. }
  477. // RegisterRedisService publish the given RedisService implementation on the server.
  478. func RegisterRedisService(srv *rpc.Server, x RedisService) error {
  479. if err := srv.RegisterName("RedisService", x); err != nil {
  480. return err
  481. }
  482. return nil
  483. }
  484. // NewRedisServiceServer returns a new RedisService Server.
  485. func NewRedisServiceServer(x RedisService) *rpc.Server {
  486. srv := rpc.NewServer()
  487. if err := srv.RegisterName("RedisService", x); err != nil {
  488. log.Fatal(err)
  489. }
  490. return srv
  491. }
  492. // ListenAndServeRedisService listen announces on the local network address laddr
  493. // and serves the given RedisService implementation.
  494. func ListenAndServeRedisService(network, addr string, x RedisService) error {
  495. lis, err := net.Listen(network, addr)
  496. if err != nil {
  497. return err
  498. }
  499. defer lis.Close()
  500. srv := rpc.NewServer()
  501. if err := srv.RegisterName("RedisService", x); err != nil {
  502. return err
  503. }
  504. for {
  505. conn, err := lis.Accept()
  506. if err != nil {
  507. log.Fatalf("lis.Accept(): %v\n", err)
  508. }
  509. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  510. }
  511. }
  512. type RedisServiceClient struct {
  513. *rpc.Client
  514. }
  515. // NewRedisServiceClient returns a RedisService rpc.Client and stub to handle
  516. // requests to the set of RedisService at the other end of the connection.
  517. func NewRedisServiceClient(conn io.ReadWriteCloser) (*RedisServiceClient, *rpc.Client) {
  518. c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
  519. return &RedisServiceClient{c}, c
  520. }
  521. func (c *RedisServiceClient) Get(in *GetRequest, out *GetStringResponse) error {
  522. return c.Call("RedisService.Get", in, out)
  523. }
  524. func (c *RedisServiceClient) Set(in *SetRequest, out *SetResponse) error {
  525. return c.Call("RedisService.Set", in, out)
  526. }
  527. func (c *RedisServiceClient) SetNx(in *SetRequest, out *DelResponse) error {
  528. return c.Call("RedisService.SetNx", in, out)
  529. }
  530. func (c *RedisServiceClient) Del(in *DelRequest, out *DelResponse) error {
  531. return c.Call("RedisService.Del", in, out)
  532. }
  533. func (c *RedisServiceClient) HGet(in *HGetRequest, out *GetStringResponse) error {
  534. return c.Call("RedisService.HGet", in, out)
  535. }
  536. func (c *RedisServiceClient) HSet(in *HSetRequest, out *HSetResponse) error {
  537. return c.Call("RedisService.HSet", in, out)
  538. }
  539. func (c *RedisServiceClient) HDel(in *HDelRequest, out *DelResponse) error {
  540. return c.Call("RedisService.HDel", in, out)
  541. }
  542. func (c *RedisServiceClient) SetExpire(in *SetExpireRequest, out *SetExpireResponse) error {
  543. return c.Call("RedisService.SetExpire", in, out)
  544. }
  545. func (c *RedisServiceClient) HGetAll(in *GetRequest, out *HGetListResponse) error {
  546. return c.Call("RedisService.HGetAll", in, out)
  547. }
  548. func (c *RedisServiceClient) HGetList(in *GetRequest, out *HGetListResponse) error {
  549. return c.Call("RedisService.HGetList", in, out)
  550. }
  551. func (c *RedisServiceClient) HExists(in *HGetRequest, out *DelResponse) error {
  552. return c.Call("RedisService.HExists", in, out)
  553. }
  554. func (c *RedisServiceClient) Exists(in *GetRequest, out *DelResponse) error {
  555. return c.Call("RedisService.Exists", in, out)
  556. }
  557. func (c *RedisServiceClient) HIncrby(in *HSetRequest, out *HSetResponse) error {
  558. return c.Call("RedisService.HIncrby", in, out)
  559. }
  560. func (c *RedisServiceClient) SAdd(in *SSetRequest, out *SSetResponse) error {
  561. return c.Call("RedisService.SAdd", in, out)
  562. }
  563. func (c *RedisServiceClient) SIsmember(in *SSetRequest, out *SSetResponse) error {
  564. return c.Call("RedisService.SIsmember", in, out)
  565. }
  566. func (c *RedisServiceClient) SRem(in *SSetRequest, out *SSetResponse) error {
  567. return c.Call("RedisService.SRem", in, out)
  568. }
  569. func (c *RedisServiceClient) LLpush(in *LSetRequest, out *LSetResponse) error {
  570. return c.Call("RedisService.LLpush", in, out)
  571. }
  572. func (c *RedisServiceClient) LRpush(in *LSetRequest, out *LSetResponse) error {
  573. return c.Call("RedisService.LRpush", in, out)
  574. }
  575. func (c *RedisServiceClient) LRange(in *LRangeRequest, out *HGetListResponse) error {
  576. return c.Call("RedisService.LRange", in, out)
  577. }
  578. func (c *RedisServiceClient) LLen(in *LLenRequest, out *LSetResponse) error {
  579. return c.Call("RedisService.LLen", in, out)
  580. }
  581. func (c *RedisServiceClient) ReduceStock(in *SetRequest, out *SetResponse) error {
  582. return c.Call("RedisService.ReduceStock", in, out)
  583. }
  584. func (c *RedisServiceClient) Incrby(in *AddRequest, out *AddResponse) error {
  585. return c.Call("RedisService.Incrby", in, out)
  586. }
  587. func (c *RedisServiceClient) Decrby(in *AddRequest, out *AddResponse) error {
  588. return c.Call("RedisService.Decrby", in, out)
  589. }
  590. // DialRedisService connects to an RedisService at the specified network address.
  591. func DialRedisService(network, addr string) (*RedisServiceClient, *rpc.Client, error) {
  592. c, err := protorpc.Dial(network, addr)
  593. if err != nil {
  594. return nil, nil, err
  595. }
  596. return &RedisServiceClient{c}, c, nil
  597. }
  598. // DialRedisServiceTimeout connects to an RedisService at the specified network address.
  599. func DialRedisServiceTimeout(network, addr string,
  600. timeout time.Duration) (*RedisServiceClient, *rpc.Client, error) {
  601. c, err := protorpc.DialTimeout(network, addr, timeout)
  602. if err != nil {
  603. return nil, nil, err
  604. }
  605. return &RedisServiceClient{c}, c, nil
  606. }