public function lookup($id) {
        if ($pos = strpos($id, ',')) {
            $id = substr($id, 0, $pos);
        }

        $cacheKey = 'volume_' . $id;

        if ($this->cache && $this->cache->has($cacheKey)) {
            $val = $this->cache->get($cacheKey);

            if (!$val instanceof Volume) {
                $val = new Volume($val);
            }

            return $val;
        }

        $res = $this->client->get($this->buildMasterUrl(self::DIR_LOOKUP), [
            'query' => [ 'volumeId' => $id ]
        ]);

        if ($res->getStatusCode() != 200) {
            throw new SeaweedFSException('Unexpected response when looking up volume: ' . $res->getStatusCode());
        }

        $body = json_decode((string) $res->getBody());

        $volume = new Volume($body);

        if ($this->cache) {
            $this->cache->put($cacheKey, $volume);
        }

        return $volume;
    }
public function lookup($id) {
        if ($pos = strpos($id, ',')) {
            $id = substr($id, 0, $pos);
        }

        $cacheKey = 'volume_' . $id;

        if ($this->cache && $this->cache->has($cacheKey)) {
            $val = $this->cache->get($cacheKey);

            if (!$val instanceof Volume) {
                $val = new Volume($val);
            }

            return $val;
        }

        $res = $this->client->get($this->buildMasterUrl(self::DIR_LOOKUP), [
            'query' => [ 'volumeId' => $id ]
        ]);

        if ($res->getStatusCode() != 200) {
            throw new SeaweedFSException('Unexpected response when looking up volume: ' . $res->getStatusCode());
        }

        $body = json_decode((string) $res->getBody());

        $volume = new Volume($body);

        if ($this->cache) {
            $this->cache->put($cacheKey, $volume);
        }

        return $volume;
    }
public function lookup ( $ id ) { if ( $ pos = strpos ( $ id , ',' ) ) { $ id = substr ( $ id , 0 , $ pos ) ; } $ cacheKey = 'volume_' . $ id ; if ( $ this -> cache && $ this -> cache -> has ( $ cacheKey ) ) { $ val = $ this -> cache -> get ( $ cacheKey ) ; if ( ! $ val instanceof Volume ) { $ val = new Volume ( $ val ) ; } return $ val ; } $ res = $ this -> client -> get ( $ this -> buildMasterUrl ( self :: DIR_LOOKUP ) , [ 'query' => [ 'volumeId' => $ id ] ] ) ; if ( $ res -> getStatusCode ( ) != 200 ) { throw new SeaweedFSException ( 'Unexpected response when looking up volume: ' . $ res -> getStatusCode ( ) ) ; } $ body = json_decode ( ( string ) $ res -> getBody ( ) ) ; $ volume = new Volume ( $ body ) ; if ( $ this -> cache ) { $ this -> cache -> put ( $ cacheKey , $ volume ) ; } return $ volume ; }
Lookup a volume or file on the master server.

@param $id
@return Volume
@throws SeaweedFSException
Lookup a volume or file on the master server .