Redis-to-HTTP proxy https://rpjios.com
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.
 
 
 

38 lines
1.0 KiB

  1. package main
  2. import (
  3. "net/url"
  4. "sync"
  5. )
  6. type RhpHandleListReqLookupFunc func(start int64, end int64) ([]string, error)
  7. type RhpPlugin interface {
  8. Version() string
  9. HandleMsg(payload interface{}) (interface{}, error)
  10. HandleListReq(dir string, file string, query url.Values, listLookup RhpHandleListReqLookupFunc) (string, error)
  11. }
  12. type rhpPluginImpl struct {
  13. Version func() string
  14. HandleMsg func(interface{}) (interface{}, error)
  15. HandleListReq func(string, string, url.Values, RhpHandleListReqLookupFunc) (string, error)
  16. }
  17. // newRhpPluginImpl is defined here so as to make it easy to keep in-sync
  18. // with the definition of rhpPluginImpl above
  19. func newRhpPluginImpl() rhpPluginImpl {
  20. return rhpPluginImpl{
  21. func() string { return "" },
  22. func(_ interface{}) (interface{}, error) { return nil, nil },
  23. func(_ string, _ string, _ url.Values, _ RhpHandleListReqLookupFunc) (string, error) { return "", nil },
  24. }
  25. }
  26. type rhpPluginMapT map[string]*rhpPluginImpl
  27. type rhpPluginsT struct {
  28. Lock sync.Mutex
  29. List rhpPluginMapT
  30. }