Documentation ¶
Overview ¶
Copyright 2021 SANGFOR TECHNOLOGIES
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func ClearCache()
- func ClearToLog(topic string, key string) bool
- func FlushHostname()
- func ForgetInstance(key string, forget bool)
- func GetAgent(addr string, valFunc func() (interface{}, error)) (*dtstruct.Agent, error)
- func GetAgentWithExpire(expire time.Duration, addr string, valFunc func() (interface{}, error)) (agt *dtstruct.Agent, err error)
- func GetAnalysis(key string) (dtstruct.AnalysisCode, bool)
- func GetCluster(key string) (string, bool)
- func GetGRPC(ctx context.Context, target string, opts ...grpc.DialOption) (conn *grpc.ClientConn, err error)
- func GetGRPCWithExpire(ctx context.Context, expire time.Duration, target string, ...) (conn *grpc.ClientConn, err error)
- func GetGRPCWithFunc(ctx context.Context, expire time.Duration, target string, ...) (*grpc.ClientConn, error)
- func GetHostname(hostname string, valFunc func() (interface{}, error)) (string, bool)
- func GetIP(hostname string, valFunc func() (interface{}, error)) ([]net.IP, error)
- func GetKV(key string) (interface{}, bool)
- func IsExistInstanceForget(key string) bool
- func IsExpire(agt *dtstruct.Agent) bool
- func ItemHostname() map[string]cache.Item
- func LogReadTopologyInstanceError(instanceKey *dtstruct.InstanceKey, hint string, err error) error
- func NewCache(name string, expiration time.Duration, cleanupInterval time.Duration) *dtstruct.Cache
- func SetAnalysis(key string, analysisCode dtstruct.AnalysisCode)
- func SetCluster(key string, clusterName string, expire time.Duration)
- func SetHostname(hostname string, resolvedHost string, expire time.Duration)
- func SetKV(key string, value bool, expire time.Duration)
- func SetOperationKey(key string, value bool, expire time.Duration) error
- func ShowCacheHit() map[string]float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearToLog ¶
ClearToLog add topic with key to cache
func ForgetInstance ¶
ForgetInstance set instance key to cache
func GetAgentWithExpire ¶
func GetAgentWithExpire(expire time.Duration, addr string, valFunc func() (interface{}, error)) (agt *dtstruct.Agent, err error)
GetAgentWithExpire return agent in cache, if not, get from function valFunc() and add to cache.
func GetAnalysis ¶
func GetAnalysis(key string) (dtstruct.AnalysisCode, bool)
GetAnalysis get analysis from cache
func GetCluster ¶
GetCluster get cluster from cache for given instance key
func GetGRPC ¶
func GetGRPC(ctx context.Context, target string, opts ...grpc.DialOption) (conn *grpc.ClientConn, err error)
GetGRPC return grpc conn in cache, if not exist, create it with default conn expire time
func GetGRPCWithExpire ¶
func GetGRPCWithExpire(ctx context.Context, expire time.Duration, target string, opts ...grpc.DialOption) (conn *grpc.ClientConn, err error)
GetGRPCWithExpire return grpc conn in cache and reset conn expire time, if not exist, create it with given expire time
func GetGRPCWithFunc ¶
func GetGRPCWithFunc(ctx context.Context, expire time.Duration, target string, blockFunc func(atomC chan struct{}), opts ...grpc.DialOption) (*grpc.ClientConn, error)
GetGRPCWithFunc return grpc conn in cache and reset conn expire time. if get read/write race, using function in param. if not exist in cache, create it with given expire time
func GetHostname ¶
GetHostname get hostname from cache
func IsExistInstanceForget ¶
IsExistInstanceForget check if instance is in cache
func LogReadTopologyInstanceError ¶
func LogReadTopologyInstanceError(instanceKey *dtstruct.InstanceKey, hint string, err error) error
LogReadTopologyInstanceError logs an error, if applicable, for a ReadTopologyInstance operation, providing context and hint as for the source of the error. If there's no hint just provide the original error.
func SetAnalysis ¶
func SetAnalysis(key string, analysisCode dtstruct.AnalysisCode)
SetAnalysis put instance analysis code to cache
func SetCluster ¶
SetCluster set key->cluster name to cache
func SetHostname ¶
SetHostname put hostname to cache
Types ¶
This section is empty.