format error

This commit is contained in:
chrislu 2024-11-21 08:52:37 -08:00
parent ca499de1cb
commit 54204bc89b
2 changed files with 7 additions and 7 deletions

View File

@ -78,12 +78,12 @@ func (store *ElasticStore) initialize(options []elastic.ClientOptionFunc) (err e
ctx := context.Background() ctx := context.Background()
store.client, err = elastic.NewClient(options...) store.client, err = elastic.NewClient(options...)
if err != nil { if err != nil {
return fmt.Errorf("init elastic %v.", err) return fmt.Errorf("init elastic %v", err)
} }
if ok, err := store.client.IndexExists(indexKV).Do(ctx); err == nil && !ok { if ok, err := store.client.IndexExists(indexKV).Do(ctx); err == nil && !ok {
_, err = store.client.CreateIndex(indexKV).Body(kvMappings).Do(ctx) _, err = store.client.CreateIndex(indexKV).Body(kvMappings).Do(ctx)
if err != nil { if err != nil {
return fmt.Errorf("create index(%s) %v.", indexKV, err) return fmt.Errorf("create index(%s) %v", indexKV, err)
} }
} }
return nil return nil
@ -114,7 +114,7 @@ func (store *ElasticStore) InsertEntry(ctx context.Context, entry *filer.Entry)
value, err := jsoniter.Marshal(esEntry) value, err := jsoniter.Marshal(esEntry)
if err != nil { if err != nil {
glog.Errorf("insert entry(%s) %v.", string(entry.FullPath), err) glog.Errorf("insert entry(%s) %v.", string(entry.FullPath), err)
return fmt.Errorf("insert entry %v.", err) return fmt.Errorf("insert entry marshal %v", err)
} }
_, err = store.client.Index(). _, err = store.client.Index().
Index(index). Index(index).
@ -124,7 +124,7 @@ func (store *ElasticStore) InsertEntry(ctx context.Context, entry *filer.Entry)
Do(ctx) Do(ctx)
if err != nil { if err != nil {
glog.Errorf("insert entry(%s) %v.", string(entry.FullPath), err) glog.Errorf("insert entry(%s) %v.", string(entry.FullPath), err)
return fmt.Errorf("insert entry %v.", err) return fmt.Errorf("insert entry %v", err)
} }
return nil return nil
} }
@ -194,7 +194,7 @@ func (store *ElasticStore) deleteEntry(ctx context.Context, index, id string) (e
} }
} }
glog.Errorf("delete entry(index:%s,_id:%s) %v.", index, id, err) glog.Errorf("delete entry(index:%s,_id:%s) %v.", index, id, err)
return fmt.Errorf("delete entry %v.", err) return fmt.Errorf("delete entry %v", err)
} }
func (store *ElasticStore) DeleteFolderChildren(ctx context.Context, fullpath weed_util.FullPath) (err error) { func (store *ElasticStore) DeleteFolderChildren(ctx context.Context, fullpath weed_util.FullPath) (err error) {

View File

@ -26,7 +26,7 @@ func (store *ElasticStore) KvDelete(ctx context.Context, key []byte) (err error)
} }
} }
glog.Errorf("delete key(id:%s) %v.", string(key), err) glog.Errorf("delete key(id:%s) %v.", string(key), err)
return fmt.Errorf("delete key %v.", err) return fmt.Errorf("delete key %v", err)
} }
func (store *ElasticStore) KvGet(ctx context.Context, key []byte) (value []byte, err error) { func (store *ElasticStore) KvGet(ctx context.Context, key []byte) (value []byte, err error) {
@ -53,7 +53,7 @@ func (store *ElasticStore) KvPut(ctx context.Context, key []byte, value []byte)
val, err := jsoniter.Marshal(esEntry) val, err := jsoniter.Marshal(esEntry)
if err != nil { if err != nil {
glog.Errorf("insert key(%s) %v.", string(key), err) glog.Errorf("insert key(%s) %v.", string(key), err)
return fmt.Errorf("insert key %v.", err) return fmt.Errorf("insert key %v", err)
} }
_, err = store.client.Index(). _, err = store.client.Index().
Index(indexKV). Index(indexKV).