This is a huge commit, it does following things: (#1942)

1. Remove ks-iam standalone binary, move it to ks-apiserver
2. Generate all devops apis inside kubesphere repository, no need to
import s2ioperator.
3. Reorganize ldap code, make it more flexible to use.
This commit is contained in:
zryfish
2020-03-10 13:50:17 +08:00
committed by GitHub
parent 7270307b66
commit 641615b299
235 changed files with 5538 additions and 38064 deletions

View File

@@ -13,10 +13,10 @@ type Interface interface {
Set(key string, value string, duration time.Duration) error
// Del deletes the given key, no error returned if the key doesn't exists
Del(key string) error
Del(keys ...string) error
// Exists checks the existence of a give key
Exists(key string) (bool, error)
Exists(keys ...string) (bool, error)
// Expires updates object's expiration time, return err if key doesn't exist
Expire(key string, duration time.Duration) error

View File

@@ -63,25 +63,30 @@ func NewRedisClient(option *Options, stopCh <-chan struct{}) (Interface, error)
}
func (r *Client) Get(key string) (string, error) {
return "", nil
return r.client.Get(key).Result()
}
func (r *Client) Keys(pattern string) ([]string, error) {
panic("implement me")
return r.client.Keys(pattern).Result()
}
func (r *Client) Set(key string, value string, duration time.Duration) error {
panic("implement me")
return r.client.Set(key, value, duration).Err()
}
func (r *Client) Del(key string) error {
panic("implement me")
func (r *Client) Del(keys ...string) error {
return r.client.Del(keys...).Err()
}
func (r *Client) Exists(key string) (bool, error) {
panic("implement me")
func (r *Client) Exists(keys ...string) (bool, error) {
existedKeys, err := r.client.Exists(keys...).Result()
if err != nil {
return false, err
}
return len(keys) == int(existedKeys), nil
}
func (r *Client) Expire(key string, duration time.Duration) error {
panic("implement me")
return r.client.Expire(key, duration).Err()
}

View File

@@ -23,7 +23,7 @@ func (s *SimpleCache) Set(key string, value string, duration time.Duration) erro
panic("implement me")
}
func (s *SimpleCache) Del(key string) error {
func (s *SimpleCache) Del(keys ...string) error {
panic("implement me")
}
@@ -31,7 +31,7 @@ func (s *SimpleCache) Get(key string) (string, error) {
return "", nil
}
func (s *SimpleCache) Exists(key string) (bool, error) {
func (s *SimpleCache) Exists(keys ...string) (bool, error) {
panic("implement me")
}