| | |
| | | |
| | | var Count = make(chan int) |
| | | |
| | | type wfOp func(a, b string) float32 |
| | | type wfOp func(a []byte, b string) float32 |
| | | |
| | | /** |
| | | * @param uint8, shardCnt must be pow of two |
| | |
| | | } |
| | | |
| | | // modify by long. |
| | | func (s *ShardMap) Walk(wf wfOp, cfrom string) ([]byte){ |
| | | func (s *ShardMap) Walk(wf wfOp, cfrom []byte) ([]byte){ |
| | | var wg sync.WaitGroup |
| | | var second float32 |
| | | var buf []byte |
| | |
| | | |
| | | wg.Add(1) |
| | | |
| | | go func(st *shardItem, fw wfOp, cf string) { |
| | | go func(st *shardItem, fw wfOp, cf []byte) { |
| | | defer wg.Done() |
| | | commonmux.Lock() |
| | | for id, feature := range st.data { |